Skip to content

Commit

Permalink
Block Hooks API: Update Navigation block feature gate (#58388)
Browse files Browse the repository at this point in the history
  • Loading branch information
tjcafferkey committed Jan 29, 2024
1 parent e1624cf commit 7e7f042
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions packages/block-library/src/navigation/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ private static function get_inner_blocks_from_navigation_post( $attributes ) {
// it encounters whitespace. This code strips it.
$blocks = block_core_navigation_filter_out_empty_blocks( $parsed_blocks );

if ( function_exists( 'get_hooked_blocks' ) ) {
if ( function_exists( 'get_hooked_block_markup' ) ) {
// Run Block Hooks algorithm to inject hooked blocks.
$markup = block_core_navigation_insert_hooked_blocks( $blocks, $navigation_post );
$root_nav_block = parse_blocks( $markup )[0];
Expand Down Expand Up @@ -987,7 +987,7 @@ function block_core_navigation_get_fallback_blocks() {
// In this case default to the (Page List) fallback.
$fallback_blocks = ! empty( $maybe_fallback ) ? $maybe_fallback : $fallback_blocks;

if ( function_exists( 'get_hooked_blocks' ) ) {
if ( function_exists( 'get_hooked_block_markup' ) ) {
// Run Block Hooks algorithm to inject hooked blocks.
// We have to run it here because we need the post ID of the Navigation block to track ignored hooked blocks.
$markup = block_core_navigation_insert_hooked_blocks( $fallback_blocks, $navigation_post );
Expand Down Expand Up @@ -1413,9 +1413,9 @@ function block_core_navigation_update_ignore_hooked_blocks_meta( $post ) {
}
}

// Injection of hooked blocks into the Navigation block relies on some functions present in WP >= 6.4
// that are not present in Gutenberg's WP 6.4 compatibility layer.
if ( function_exists( 'get_hooked_blocks' ) ) {
// Injection of hooked blocks into the Navigation block relies on some functions present in WP >= 6.5
// that are not present in Gutenberg's WP 6.5 compatibility layer.
if ( function_exists( 'get_hooked_block_markup' ) ) {
add_action( 'rest_insert_wp_navigation', 'block_core_navigation_update_ignore_hooked_blocks_meta', 10, 3 );
}

Expand Down Expand Up @@ -1445,8 +1445,8 @@ function block_core_navigation_insert_hooked_blocks_into_rest_response( $respons
return $response;
}

// Injection of hooked blocks into the Navigation block relies on some functions present in WP >= 6.4
// that are not present in Gutenberg's WP 6.4 compatibility layer.
if ( function_exists( 'get_hooked_blocks' ) ) {
// Injection of hooked blocks into the Navigation block relies on some functions present in WP >= 6.5
// that are not present in Gutenberg's WP 6.5 compatibility layer.
if ( function_exists( 'get_hooked_block_markup' ) ) {
add_filter( 'rest_prepare_wp_navigation', 'block_core_navigation_insert_hooked_blocks_into_rest_response', 10, 3 );
}

1 comment on commit 7e7f042

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in 7e7f042.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7699198583
📝 Reported issues:

Please sign in to comment.