diff --git a/src/wp-includes/block-bindings.php b/src/wp-includes/block-bindings.php index 268bb6afa66bb..a68c67476abfb 100644 --- a/src/wp-includes/block-bindings.php +++ b/src/wp-includes/block-bindings.php @@ -147,6 +147,7 @@ function get_block_bindings_supported_attributes( $block_type ) { 'core/post-date' => array( 'datetime' ), 'core/navigation-link' => array( 'url' ), 'core/navigation-submenu' => array( 'url' ), + 'core/verse' => array( 'content' ), ); $supported_block_attributes = diff --git a/tests/phpunit/tests/block-bindings/render.php b/tests/phpunit/tests/block-bindings/render.php index 77b0975105dc5..d72462bbd5a84 100644 --- a/tests/phpunit/tests/block-bindings/render.php +++ b/tests/phpunit/tests/block-bindings/render.php @@ -92,6 +92,16 @@ public function data_update_block_with_value_from_source() { , '
test source value
', ), + 'verse block' => array( + 'content', + << +This should not appear+ +HTML + , + '
test source value', + ), 'button block' => array( 'text', << +
This should not appear+ +HTML; + + $expected_content = 'This is the verse content value'; + $parsed_blocks = parse_blocks( $block_content ); + $block = new WP_Block( + $parsed_blocks[0], + array( + 'pattern/overrides' => array( + 'Test verse' => array( + 'content' => $expected_content, + ), + ), + ) + ); + + $result = $block->render(); + + $this->assertSame( + "
$expected_content", + trim( $result ), + 'The `__default` attribute should be replaced with the verse content binding.' + ); + + $expected_bindings_metadata = array( + 'content' => array( 'source' => 'core/pattern-overrides' ), + ); + $this->assertSame( + $expected_bindings_metadata, + $block->attributes['metadata']['bindings'], + 'The __default binding should be updated with the Verse content binding.' + ); + } + /** * Tests that filter `block_bindings_source_value` is applied. *