From e36d0969478e143f5319f8b14c4b92ade2c40f3f Mon Sep 17 00:00:00 2001 From: Bernie Reiter Date: Wed, 31 Jan 2024 14:59:47 +0100 Subject: [PATCH] Revert "Block Hooks API: Update Navigation block feature gate (#58388)" This reverts commit 7e7f042547132269615e4ae9d9792df97c4999bf. --- packages/block-library/src/navigation/index.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/block-library/src/navigation/index.php b/packages/block-library/src/navigation/index.php index 59b4a66a1babd1..2094b7de1607b1 100644 --- a/packages/block-library/src/navigation/index.php +++ b/packages/block-library/src/navigation/index.php @@ -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_block_markup' ) ) { + if ( function_exists( 'get_hooked_blocks' ) ) { // 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]; @@ -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_block_markup' ) ) { + if ( function_exists( 'get_hooked_blocks' ) ) { // 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 ); @@ -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.5 -// that are not present in Gutenberg's WP 6.5 compatibility layer. -if ( function_exists( 'get_hooked_block_markup' ) ) { +// 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' ) ) { add_action( 'rest_insert_wp_navigation', 'block_core_navigation_update_ignore_hooked_blocks_meta', 10, 3 ); } @@ -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.5 -// that are not present in Gutenberg's WP 6.5 compatibility layer. -if ( function_exists( 'get_hooked_block_markup' ) ) { +// 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' ) ) { add_filter( 'rest_prepare_wp_navigation', 'block_core_navigation_insert_hooked_blocks_into_rest_response', 10, 3 ); }