From 23e8ce70f00530332ed5efe50b4d0c20245bb7c1 Mon Sep 17 00:00:00 2001 From: cbravobernal Date: Thu, 26 Sep 2024 14:51:18 +0000 Subject: [PATCH] Block bindings: Ensure block receives __default bindings when render. Fixes an issue with the image block when using pattern overrides, where the image block with overrides enabled was not outputting all the expected image attributes. Ensures that the `process_block_bindings` method returns any updates to the block's binding metadata along with other computed attributes. Props talldanwp, cbravobernal, santosguillamot, mukesh27, gziolo. Fixes #62069. Built from https://develop.svn.wordpress.org/trunk@59095 git-svn-id: http://core.svn.wordpress.org/trunk@58491 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-block.php | 9 +++++++++ wp-includes/version.php | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/wp-includes/class-wp-block.php b/wp-includes/class-wp-block.php index d4481a68a7..8cfa996028 100644 --- a/wp-includes/class-wp-block.php +++ b/wp-includes/class-wp-block.php @@ -237,6 +237,7 @@ class WP_Block { * * @since 6.5.0 * @since 6.6.0 Handle the `__default` attribute for pattern overrides. + * @since 6.7.0 Return any updated bindings metadata in the computed attributes. * * @return array The computed block attributes for the provided block bindings. */ @@ -284,6 +285,14 @@ class WP_Block { : array( 'source' => 'core/pattern-overrides' ); } $bindings = $updated_bindings; + /* + * Update the bindings metadata of the computed attributes. + * This ensures the block receives the expanded __default binding metadata when it renders. + */ + $computed_attributes['metadata'] = array_merge( + $parsed_block['attrs']['metadata'], + array( 'bindings' => $bindings ) + ); } foreach ( $bindings as $attribute_name => $block_binding ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index d17e0a9bd1..ebb8e5d058 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.7-alpha-59094'; +$wp_version = '6.7-alpha-59095'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.