Skip to content

Commit

Permalink
Navigation block: Use apply_block_hooks_to_content() (#65703)
Browse files Browse the repository at this point in the history
* Navigation block: Use apply-block-hooks-to-content

* WPCS

Co-authored-by: ockham <[email protected]>
Co-authored-by: ramonjd <[email protected]>
Co-authored-by: aaronrobertshaw <[email protected]>
  • Loading branch information
4 people authored Sep 30, 2024
1 parent 65e7db0 commit 56f6deb
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/block-library/src/navigation/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -1499,9 +1499,15 @@ function block_core_navigation_mock_parsed_block( $inner_blocks, $post ) {
*/
function block_core_navigation_insert_hooked_blocks( $inner_blocks, $post ) {
$mock_navigation_block = block_core_navigation_mock_parsed_block( $inner_blocks, $post );
$hooked_blocks = get_hooked_blocks();
$before_block_visitor = null;
$after_block_visitor = null;

if ( function_exists( 'apply_block_hooks_to_content' ) ) {
$mock_navigation_block_markup = serialize_block( $mock_navigation_block );
return apply_block_hooks_to_content( $mock_navigation_block_markup, $post, 'insert_hooked_blocks' );
}

$hooked_blocks = get_hooked_blocks();
$before_block_visitor = null;
$after_block_visitor = null;

if ( ! empty( $hooked_blocks ) || has_filter( 'hooked_block_types' ) ) {
$before_block_visitor = make_before_block_visitor( $hooked_blocks, $post, 'insert_hooked_blocks' );
Expand Down

0 comments on commit 56f6deb

Please sign in to comment.