Changeset 57039
- Timestamp:
- 10/31/2023 07:38:08 PM (11 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/6.4/src/wp-includes/blocks.php
r56960 r57039 774 774 * `first_child`, respectively, to the serialized markup for the given block. 775 775 * 776 * @param array $block The block to inject the theme attribute into, and hooked blocks before. 777 * @param array $parent_block The parent block of the given block. 778 * @param array $prev The previous sibling block of the given block. 776 * @param array $block The block to inject the theme attribute into, and hooked blocks before. Passed by reference. 777 * @param array $parent_block The parent block of the given block. Passed by reference. Default null. 778 * @param array $prev The previous sibling block of the given block. Default null. 779 779 * @return string The serialized markup for the given block, with the markup for any hooked blocks prepended to it. 780 780 */ 781 return function ( &$block, $parent_block = null, $prev = null ) use ( $hooked_blocks, $context ) {781 return function ( &$block, &$parent_block = null, $prev = null ) use ( $hooked_blocks, $context ) { 782 782 _inject_theme_attribute_in_template_part_block( $block ); 783 783 … … 847 847 * `last_child`, respectively, to the serialized markup for the given block. 848 848 * 849 * @param array $block The block to inject the hooked blocks after. 850 * @param array $parent_block The parent block of the given block. 851 * @param array $next The next sibling block of the given block. 849 * @param array $block The block to inject the hooked blocks after. Passed by reference. 850 * @param array $parent_block The parent block of the given block. Passed by reference. Default null. 851 * @param array $next The next sibling block of the given block. Default null. 852 852 * @return string The serialized markup for the given block, with the markup for any hooked blocks appended to it. 853 853 */ 854 return function ( &$block, $parent_block = null, $next = null ) use ( $hooked_blocks, $context ) {854 return function ( &$block, &$parent_block = null, $next = null ) use ( $hooked_blocks, $context ) { 855 855 $markup = ''; 856 856 … … 1059 1059 $block_content .= call_user_func_array( 1060 1060 $pre_callback, 1061 array( &$inner_block, $block, $prev )1061 array( &$inner_block, &$block, $prev ) 1062 1062 ); 1063 1063 } … … 1072 1072 $block_content .= call_user_func_array( 1073 1073 $post_callback, 1074 array( &$inner_block, $block, $next )1074 array( &$inner_block, &$block, $next ) 1075 1075 ); 1076 1076 } … … 1123 1123 */ 1124 1124 function traverse_and_serialize_blocks( $blocks, $pre_callback = null, $post_callback = null ) { 1125 $result = ''; 1125 $result = ''; 1126 $parent_block = null; // At the top level, there is no parent block to pass to the callbacks; yet the callbacks expect a reference. 1127 1126 1128 foreach ( $blocks as $index => $block ) { 1127 1129 if ( is_callable( $pre_callback ) ) { … … 1132 1134 $result .= call_user_func_array( 1133 1135 $pre_callback, 1134 array( &$block, null, $prev ) // At the top level, there is no parent block to pass to the callback.1136 array( &$block, &$parent_block, $prev ) 1135 1137 ); 1136 1138 } … … 1145 1147 $result .= call_user_func_array( 1146 1148 $post_callback, 1147 array( &$block, null, $next ) // At the top level, there is no parent block to pass to the callback.1149 array( &$block, &$parent_block, $next ) 1148 1150 ); 1149 1151 }
Note: See TracChangeset
for help on using the changeset viewer.