Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Rename var from parent to parent_block
  • Loading branch information
ockham committed Oct 31, 2023
commit 7aa6c9cd0c99f3281995458fe54effd3d7ccf651
9 changes: 5 additions & 4 deletions src/wp-includes/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -1131,8 +1131,9 @@ function traverse_and_serialize_block( $block, $pre_callback = null, $post_callb
* @return string Serialized block markup.
*/
function traverse_and_serialize_blocks( $blocks, $pre_callback = null, $post_callback = null ) {
$result = '';
$parent = null; // At the top level, there is no parent block to pass to the callbacks; yet the callbacks expect a reference.
$result = '';
$parent_block = null; // At the top level, there is no parent block to pass to the callbacks; yet the callbacks expect a reference.

foreach ( $blocks as $index => $block ) {
if ( is_callable( $pre_callback ) ) {
$prev = 0 === $index
Expand All @@ -1141,7 +1142,7 @@ function traverse_and_serialize_blocks( $blocks, $pre_callback = null, $post_cal

$result .= call_user_func_array(
$pre_callback,
array( &$block, &$parent, $prev )
array( &$block, &$parent_block, $prev )
);
}

Expand All @@ -1152,7 +1153,7 @@ function traverse_and_serialize_blocks( $blocks, $pre_callback = null, $post_cal

$post_markup = call_user_func_array(
$post_callback,
array( &$block, &$parent, $next )
array( &$block, &$parent_block, $next )
);
}

Expand Down