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
Next Next commit
Change argument order
  • Loading branch information
ockham committed Nov 28, 2023
commit f29ba5589886cf4059839f4f698e5e7f93007741
10 changes: 5 additions & 5 deletions src/wp-includes/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ function get_hooked_blocks() {
return $hooked_blocks;
}

function insert_hooked_blocks( $relative_position, &$anchor_block, $hooked_blocks, $context ) {
function insert_hooked_blocks( &$anchor_block, $relative_position, $hooked_blocks, $context ) {
$anchor_block_type = $anchor_block['blockName'];
$hooked_block_types = isset( $hooked_blocks[ $anchor_block_type ][ $relative_position ] )
? $hooked_blocks[ $anchor_block_type ][ $relative_position ]
Expand Down Expand Up @@ -833,10 +833,10 @@ function make_before_block_visitor( $hooked_blocks, $context ) {

if ( $parent_block && ! $prev ) {
// Candidate for first-child insertion.
$markup .= insert_hooked_blocks( 'first_child', $parent_block, $hooked_blocks, $context );
$markup .= insert_hooked_blocks( $parent_block, 'first_child', $hooked_blocks, $context );
}

$markup .= insert_hooked_blocks( 'before', $block, $hooked_blocks, $context );
$markup .= insert_hooked_blocks( $block, 'before', $hooked_blocks, $context );

return $markup;
};
Expand Down Expand Up @@ -872,11 +872,11 @@ function make_after_block_visitor( $hooked_blocks, $context ) {
* @return string The serialized markup for the given block, with the markup for any hooked blocks appended to it.
*/
return function ( &$block, &$parent_block = null, $next = null ) use ( $hooked_blocks, $context ) {
$markup = insert_hooked_blocks( 'after', $block, $hooked_blocks, $context );
$markup = insert_hooked_blocks( $block, 'after', $hooked_blocks, $context );

if ( $parent_block && ! $next ) {
// Candidate for last-child insertion.
$markup .= insert_hooked_blocks( 'last_child', $parent_block, $hooked_blocks, $context );
$markup .= insert_hooked_blocks( $parent_block, 'last_child', $hooked_blocks, $context );
}

return $markup;
Expand Down