Skip to content

Commit

Permalink
Rearrange logic a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
ockham committed Nov 28, 2023
1 parent d7e47ba commit 12a5251
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/wp-includes/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -778,19 +778,20 @@ function insert_hooked_blocks( $relative_position, &$anchor_block, $hooked_block
$hooked_block_types = apply_filters( 'hooked_block_types', $hooked_block_types, $relative_position, $anchor_block_type, $context );
foreach ( $hooked_block_types as $hooked_block_type ) {
if (
! isset( $anchor_block['attrs']['metadata']['ignoredHookedBlocks'] ) ||
! in_array( $hooked_block_type, $anchor_block['attrs']['metadata']['ignoredHookedBlocks'] )
isset( $anchor_block['attrs']['metadata']['ignoredHookedBlocks'] ) &&
in_array( $hooked_block_type, $anchor_block['attrs']['metadata']['ignoredHookedBlocks'] )
) {
$markup .= get_comment_delimited_block_content( $hooked_block_type, array(), '' );
continue;
}

$markup .= get_comment_delimited_block_content( $hooked_block_type, array(), '' );

// TODO: The following is only needed for the REST API endpoint.
// Ideally, the code should thus be moved into the controller.
if ( ! isset( $anchor_block['attrs']['metadata']['ignoredHookedBlocks'] ) ) {
$anchor_block['attrs']['metadata']['ignoredHookedBlocks'] = array();
}
$anchor_block['attrs']['metadata']['ignoredHookedBlocks'][] = $hooked_block_type;

}
return $markup;
}
Expand Down

0 comments on commit 12a5251

Please sign in to comment.