Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block Hooks API: Refactor Navigation to account for get_hooked_blocks_by_anchor_block #62658

Open
wants to merge 3 commits into
base: trunk
Choose a base branch
from
Open
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
Coding standards
  • Loading branch information
tjcafferkey committed Jun 19, 2024
commit 2179a8172da5e4f3b4cc44a59a431db86e23cc38
8 changes: 4 additions & 4 deletions packages/block-library/src/navigation/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -1515,13 +1515,13 @@ function block_core_navigation_insert_hooked_blocks( $inner_blocks, $post ) {
$before_block_visitor = null;
$after_block_visitor = null;

if ( function_exists('get_hooked_blocks_by_anchor_block') ) {
if ( function_exists( 'get_hooked_blocks_by_anchor_block' ) ) {
if ( maybe_has_hooked_blocks() ) {
$before_block_visitor = make_before_block_visitor( $post, 'insert_hooked_blocks' );
$after_block_visitor = make_after_block_visitor( $post, 'insert_hooked_blocks' );
}
} else {
$hooked_blocks = get_hooked_blocks();
$hooked_blocks = get_hooked_blocks();
if ( ! empty( $hooked_blocks ) || has_filter( 'hooked_block_types' ) ) {
$before_block_visitor = make_before_block_visitor( $hooked_blocks, $post, 'insert_hooked_blocks' );
$after_block_visitor = make_after_block_visitor( $hooked_blocks, $post, 'insert_hooked_blocks' );
Expand Down Expand Up @@ -1549,13 +1549,13 @@ function block_core_navigation_set_ignored_hooked_blocks_metadata( $inner_blocks
$before_block_visitor = null;
$after_block_visitor = null;

if ( function_exists('get_hooked_blocks_by_anchor_block') ) {
if ( function_exists( 'get_hooked_blocks_by_anchor_block' ) ) {
if ( maybe_has_hooked_blocks() ) {
$before_block_visitor = make_before_block_visitor( $post, 'set_ignored_hooked_blocks_metadata' );
$after_block_visitor = make_after_block_visitor( $post, 'set_ignored_hooked_blocks_metadata' );
}
} else {
$hooked_blocks = get_hooked_blocks();
$hooked_blocks = get_hooked_blocks();
if ( ! empty( $hooked_blocks ) || has_filter( 'hooked_block_types' ) ) {
$before_block_visitor = make_before_block_visitor( $hooked_blocks, $post, 'set_ignored_hooked_blocks_metadata' );
$after_block_visitor = make_after_block_visitor( $hooked_blocks, $post, 'set_ignored_hooked_blocks_metadata' );
Expand Down
Loading