Changeset 58186
- Timestamp:
- 05/23/2024 06:33:11 PM (2 months ago)
- Location:
- trunk
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/block-template-utils.php
r58084 r58186 599 599 $hooked_blocks = get_hooked_blocks(); 600 600 if ( ! empty( $hooked_blocks ) || has_filter( 'hooked_block_types' ) ) { 601 $before_block_visitor = make_before_block_visitor( $hooked_blocks, $template );602 $after_block_visitor = make_after_block_visitor( $hooked_blocks, $template );601 $before_block_visitor = make_before_block_visitor( $hooked_blocks, $template ); 602 $after_block_visitor = make_after_block_visitor( $hooked_blocks, $template ); 603 603 } 604 604 $blocks = parse_blocks( $template->content ); … … 985 985 $hooked_blocks = get_hooked_blocks(); 986 986 if ( ! empty( $hooked_blocks ) || has_filter( 'hooked_block_types' ) ) { 987 $before_block_visitor = make_before_block_visitor( $hooked_blocks, $template );988 $after_block_visitor = make_after_block_visitor( $hooked_blocks, $template );987 $before_block_visitor = make_before_block_visitor( $hooked_blocks, $template ); 988 $after_block_visitor = make_after_block_visitor( $hooked_blocks, $template ); 989 989 $blocks = parse_blocks( $template->content ); 990 990 $template->content = traverse_and_serialize_blocks( $blocks, $before_block_visitor, $after_block_visitor ); -
trunk/src/wp-includes/blocks.php
r58084 r58186 859 859 * @access private 860 860 * 861 * @param array $parsed_anchor_block The anchor block, in parsed block array format.862 * @param string $relative_position The relative position of the hooked blocks.863 * Can be one of 'before', 'after', 'first_child', or 'last_child'.864 * @param array $hooked_blocks An array of hooked block types, grouped by anchor block and relative position.865 * @param WP_Block_Template| array $context The block template, template part, or pattern that the anchor block belongs to.861 * @param array $parsed_anchor_block The anchor block, in parsed block array format. 862 * @param string $relative_position The relative position of the hooked blocks. 863 * Can be one of 'before', 'after', 'first_child', or 'last_child'. 864 * @param array $hooked_blocks An array of hooked block types, grouped by anchor block and relative position. 865 * @param WP_Block_Template|array $context The block template, template part, or pattern that the anchor block belongs to. 866 866 * @return string 867 867 */ … … 950 950 * @access private 951 951 * 952 * @param array $parsed_anchor_block The anchor block, in parsed block array format.953 * @param string $relative_position The relative position of the hooked blocks.954 * Can be one of 'before', 'after', 'first_child', or 'last_child'.955 * @param array $hooked_blocks An array of hooked block types, grouped by anchor block and relative position.956 * @param WP_Block_Template| array $context The block template, template part, or pattern that the anchor block belongs to.957 * @return string An empty string.952 * @param array $parsed_anchor_block The anchor block, in parsed block array format. 953 * @param string $relative_position The relative position of the hooked blocks. 954 * Can be one of 'before', 'after', 'first_child', or 'last_child'. 955 * @param array $hooked_blocks An array of hooked block types, grouped by anchor block and relative position. 956 * @param WP_Block_Template|array $context The block template, template part, or pattern that the anchor block belongs to. 957 * @return string mpty string. 958 958 */ 959 959 function set_ignored_hooked_blocks_metadata( &$parsed_anchor_block, $relative_position, $hooked_blocks, $context ) { … … 1001 1001 // Markup for the hooked blocks has already been created (in `insert_hooked_blocks`). 1002 1002 return ''; 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1003 1026 } 1004 1027 -
trunk/src/wp-includes/class-wp-block-patterns-registry.php
r57731 r58186 175 175 $after_block_visitor = null; 176 176 if ( ! empty( $hooked_blocks ) || has_filter( 'hooked_block_types' ) ) { 177 $before_block_visitor = make_before_block_visitor( $hooked_blocks, $pattern );178 $after_block_visitor = make_after_block_visitor( $hooked_blocks, $pattern );177 $before_block_visitor = make_before_block_visitor( $hooked_blocks, $pattern ); 178 $after_block_visitor = make_after_block_visitor( $hooked_blocks, $pattern ); 179 179 } 180 180 $blocks = parse_blocks( $content ); -
trunk/tests/phpunit/tests/blocks/getHookedBlocks.php
r57627 r58186 152 152 ); 153 153 $this->assertStringContainsString( 154 '<!-- wp:post-content {"layout":{"type":"constrained"} } /-->'154 '<!-- wp:post-content {"layout":{"type":"constrained"}} /-->' 155 155 . '<!-- wp:tests/hooked-after /-->', 156 156 $template->content … … 181 181 $this->assertStringContainsString( 182 182 '<!-- wp:tests/hooked-before /-->' 183 . '<!-- wp:navigation {"layout":{"type":"flex","setCascadingProperties":true,"justifyContent":"right"} } /-->',183 . '<!-- wp:navigation {"layout":{"type":"flex","setCascadingProperties":true,"justifyContent":"right"}} /-->', 184 184 $template->content 185 185 ); … … 222 222 ); 223 223 $this->assertStringContainsString( 224 '<!-- wp:comments -->'224 '<!-- wp:comments -->' 225 225 . '<div class="wp-block-comments">' 226 226 . '<!-- wp:tests/hooked-first-child /-->',
Note: See TracChangeset
for help on using the changeset viewer.