Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"icon": "video-alt",
"description": "A read only block to display the Genre(s) for a Movie.",
"parent": ["tenup/metadata"],
"usesContext": ["postId", "postType"],
"attributes": {},
"supports": {
"html": false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,14 @@

use TenUpPlugin\Taxonomies\Genre;

$terms = get_the_terms( get_the_ID(), Genre::TAXONOMY_NAME );
$context = $block->context;
$post_id = $context['postId'] ?? null;

if ( ! $post_id ) {
return;
}

$terms = get_the_terms( $post_id, Genre::TAXONOMY_NAME );

if ( false === $terms || is_wp_error( $terms ) ) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"icon": "video-alt",
"description": "A read only block to display the plot post meta for a Movie.",
"parent": ["tenup/metadata"],
"usesContext": ["postId", "postType"],
"attributes": {},
"supports": {
"html": false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@
* @var WP_Block $block Block instance.
*/

$plot = get_post_meta( get_the_ID(), 'tenup_movie_plot', true ) ?? '';
$context = $block->context;
$post_id = $context['postId'] ?? null;

if ( ! $post_id ) {
return;
}

$plot = get_post_meta( $post_id, 'tenup_movie_plot', true ) ?? '';

if ( '' === $plot ) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"icon": "video-alt",
"description": "A read only block to display the stars for a Movie.",
"parent": ["tenup/metadata"],
"usesContext": ["postId", "postType"],
"attributes": {},
"supports": {
"html": false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
* @var WP_Block $block Block instance.
*/

// Get the current post ID (movie post).
$post_id = get_the_ID();
$context = $block->context;
$post_id = $context['postId'] ?? null;

if ( ! $post_id ) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"category": "text",
"icon": "thumbs-up",
"description": "A read only block to display the MPA rating post meta for a Movie.",
"usesContext": ["postId", "postType"],
"attributes": {},
"supports": {
"html": false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@
* @var WP_Block $block Block instance.
*/

$rating = get_post_meta( get_the_ID(), 'tenup_movie_mpa_rating', true ) ?? '';
$context = $block->context;
$post_id = $context['postId'] ?? null;

if ( ! $post_id ) {
return;
}

$rating = get_post_meta( $post_id, 'tenup_movie_mpa_rating', true ) ?? '';

if ( '' === $rating ) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"category": "text",
"icon": "calendar",
"description": "A read only block to display the release year post meta for a Movie.",
"usesContext": ["postId", "postType"],
"attributes": {},
"supports": {
"html": false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@
* @var WP_Block $block Block instance.
*/

$year = get_post_meta( get_the_ID(), 'tenup_movie_release_year', true ) ?? '';
$context = $block->context;
$post_id = $context['postId'] ?? null;

if ( ! $post_id ) {
return;
}

$year = get_post_meta( $post_id, 'tenup_movie_release_year', true ) ?? '';

if ( '' === $year ) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"category": "text",
"icon": "backup",
"description": "A read only block to display the runtime post meta for a Movie.",
"usesContext": ["postId", "postType"],
"attributes": {},
"supports": {
"html": false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@
* @var WP_Block $block Block instance.
*/

$runtime = get_post_meta( get_the_ID(), 'tenup_movie_runtime', true ) ?? '';
$context = $block->context;
$post_id = $context['postId'] ?? null;

if ( ! $post_id ) {
return;
}

$runtime = get_post_meta( $post_id, 'tenup_movie_runtime', true ) ?? '';

if ( '' === $runtime ) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"category": "text",
"icon": "admin-users",
"description": "A read only block to display the biography post meta for a Person.",
"usesContext": ["postId", "postType"],
"parent": ["tenup/metadata"],
"attributes": {},
"supports": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@
* @var WP_Block $block Block instance.
*/

$biography = get_post_meta( get_the_ID(), 'tenup_person_biography', true ) ?? '';
$context = $block->context;
$post_id = $context['postId'] ?? null;

if ( ! $post_id ) {
return;
}

$biography = get_post_meta( $post_id, 'tenup_person_biography', true ) ?? '';

if ( '' === $biography ) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"category": "text",
"icon": "admin-users",
"description": "A read only block to display the birthplace post meta for a Person.",
"usesContext": ["postId", "postType"],
"parent": ["tenup/metadata"],
"attributes": {},
"supports": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@
* @var WP_Block $block Block instance.
*/

$birthplace = get_post_meta( get_the_ID(), 'tenup_person_birthplace', true ) ?? '';
$context = $block->context;
$post_id = $context['postId'] ?? null;

if ( ! $post_id ) {
return;
}

$birthplace = get_post_meta( $post_id, 'tenup_person_birthplace', true ) ?? '';

if ( '' === $birthplace ) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"icon": "admin-users",
"description": "A read only block to display the born post meta for a Person.",
"parent": ["tenup/metadata"],
"usesContext": ["postId", "postType"],
"attributes": {},
"supports": {
"html": false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@
* @var WP_Block $block Block instance.
*/

$born = get_post_meta( get_the_ID(), 'tenup_person_born', true ) ?? '';
$context = $block->context;
$post_id = $context['postId'] ?? null;

if ( ! $post_id ) {
return;
}

$born = get_post_meta( $post_id, 'tenup_person_born', true ) ?? '';

if ( '' === $born ) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"icon": "admin-users",
"description": "A read only block to display the deathplace post meta for a Person.",
"parent": ["tenup/metadata"],
"usesContext": ["postId", "postType"],
"attributes": {},
"supports": {
"html": false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@
* @var WP_Block $block Block instance.
*/

$deathplace = get_post_meta( get_the_ID(), 'tenup_person_deathplace', true ) ?? '';
$context = $block->context;
$post_id = $context['postId'] ?? null;

if ( ! $post_id ) {
return;
}

$deathplace = get_post_meta( $post_id, 'tenup_person_deathplace', true ) ?? '';

if ( '' === $deathplace ) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"category": "text",
"icon": "admin-users",
"description": "A read only block to display the died post meta for a Person.",
"usesContext": ["postId", "postType"],
"parent": ["tenup/metadata"],
"attributes": {},
"supports": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@
* @var WP_Block $block Block instance.
*/

$died = get_post_meta( get_the_ID(), 'tenup_person_died', true ) ?? '';
$context = $block->context;
$post_id = $context['postId'] ?? null;

if ( ! $post_id ) {
return;
}

$died = get_post_meta( $post_id, 'tenup_person_died', true ) ?? '';

if ( '' === $died ) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"icon": "admin-users",
"description": "A read only block to display the movies for a Person.",
"parent": ["tenup/metadata"],
"usesContext": ["postId", "postType"],
"attributes": {},
"supports": {
"html": false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
* @var WP_Block $block Block instance.
*/

// Get the current post ID (person post).
$post_id = get_the_ID();
$context = $block->context;
$post_id = $context['postId'] ?? null;

if ( ! $post_id ) {
return;
Expand Down