Changeset 56680 for trunk/src/wp-includes/blocks.php
- Timestamp:
- 09/25/2023 03:34:34 PM (2 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/blocks.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/blocks.php
r56678 r56680 791 791 * `first_child`, respectively, to the serialized markup for the given block. 792 792 * 793 * @param array $block The block to inject the theme attribute into, and hooked blocks before.794 * @param array $parent The parent block of the given block.795 * @param array $prev The previous sibling block of the given block.793 * @param array $block The block to inject the theme attribute into, and hooked blocks before. 794 * @param array $parent_block The parent block of the given block. 795 * @param array $prev The previous sibling block of the given block. 796 796 * @return string The serialized markup for the given block, with the markup for any hooked blocks prepended to it. 797 797 */ 798 return function ( &$block, $parent= null, $prev = null ) use ( $context ) {798 return function ( &$block, $parent_block = null, $prev = null ) use ( $context ) { 799 799 _inject_theme_attribute_in_template_part_block( $block ); 800 800 801 801 $markup = ''; 802 802 803 if ( $parent && ! $prev ) {803 if ( $parent_block && ! $prev ) { 804 804 // Candidate for first-child insertion. 805 805 $relative_position = 'first_child'; 806 $anchor_block_type = $parent ['blockName'];806 $anchor_block_type = $parent_block['blockName']; 807 807 $hooked_block_types = array_keys( get_hooked_blocks( $anchor_block_type, $relative_position ) ); 808 808 /** … … 857 857 * `last_child`, respectively, to the serialized markup for the given block. 858 858 * 859 * @param array $block The block to inject the hooked blocks after.860 * @param array $parent The parent block of the given block.861 * @param array $next The next sibling block of the given block.859 * @param array $block The block to inject the hooked blocks after. 860 * @param array $parent_block The parent block of the given block. 861 * @param array $next The next sibling block of the given block. 862 862 * @return string The serialized markup for the given block, with the markup for any hooked blocks appended to it. 863 863 */ 864 return function ( &$block, $parent= null, $next = null ) use ( $context ) {864 return function ( &$block, $parent_block = null, $next = null ) use ( $context ) { 865 865 $markup = ''; 866 866 … … 874 874 } 875 875 876 if ( $parent && ! $next ) {876 if ( $parent_block && ! $next ) { 877 877 // Candidate for last-child insertion. 878 878 $relative_position = 'last_child'; 879 $anchor_block_type = $parent ['blockName'];879 $anchor_block_type = $parent_block['blockName']; 880 880 $hooked_block_types = array_keys( get_hooked_blocks( $anchor_block_type, $relative_position ) ); 881 881 /** This filter is documented in wp-includes/blocks.php */ … … 1060 1060 ? null 1061 1061 : $block['innerBlocks'][ $block_index - 1 ]; 1062 1062 1063 $block_content .= call_user_func_array( 1063 1064 $pre_callback, … … 1072 1073 ? null 1073 1074 : $block['innerBlocks'][ $block_index + 1 ]; 1075 1074 1076 $block_content .= call_user_func_array( 1075 1077 $post_callback, … … 1077 1079 ); 1078 1080 } 1079 $block_index++;1081 ++$block_index; 1080 1082 } 1081 1083 } … … 1131 1133 ? null 1132 1134 : $blocks[ $index - 1 ]; 1135 1133 1136 $result .= call_user_func_array( 1134 1137 $pre_callback, … … 1136 1139 ); 1137 1140 } 1141 1138 1142 $result .= traverse_and_serialize_block( $block, $pre_callback, $post_callback ); 1143 1139 1144 if ( is_callable( $post_callback ) ) { 1140 1145 $next = count( $blocks ) - 1 === $index 1141 1146 ? null 1142 1147 : $blocks[ $index + 1 ]; 1148 1143 1149 $result .= call_user_func_array( 1144 1150 $post_callback, … … 1147 1153 } 1148 1154 } 1155 1149 1156 return $result; 1150 1157 }
Note: See TracChangeset
for help on using the changeset viewer.