Make WordPress Core


Ignore:
Timestamp:
09/20/2024 01:53:52 AM (6 months ago)
Author:
noisysocks
Message:

Editor: Update packages for 6.7 Beta 1.

Syncs @wordpress/* packages to the wp-6.7 npm tag.

Fixes #61906.
Props peterwilsoncc, gziolo, kevin940726.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/blocks/navigation.php

    r58565 r59072  
    242242            $blocks = block_core_navigation_filter_out_empty_blocks( $parsed_blocks );
    243243
    244             if ( function_exists( 'set_ignored_hooked_blocks_metadata' ) ) {
    245                 // Run Block Hooks algorithm to inject hooked blocks.
    246                 $markup         = block_core_navigation_insert_hooked_blocks( $blocks, $navigation_post );
    247                 $root_nav_block = parse_blocks( $markup )[0];
    248 
    249                 $blocks = isset( $root_nav_block['innerBlocks'] ) ? $root_nav_block['innerBlocks'] : $blocks;
    250             }
     244            // Run Block Hooks algorithm to inject hooked blocks.
     245            $markup         = block_core_navigation_insert_hooked_blocks( $blocks, $navigation_post );
     246            $root_nav_block = parse_blocks( $markup )[0];
     247
     248            $blocks = isset( $root_nav_block['innerBlocks'] ) ? $root_nav_block['innerBlocks'] : $blocks;
    251249
    252250            // TODO - this uses the full navigation block attributes for the
     
    484482        }
    485483        $toggle_button_content       = $should_display_icon_label ? $toggle_button_icon : __( 'Menu' );
    486         $toggle_close_button_icon    = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" aria-hidden="true" focusable="false"><path d="M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"></path></svg>';
     484        $toggle_close_button_icon    = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" aria-hidden="true" focusable="false"><path d="m13.06 12 6.47-6.47-1.06-1.06L12 10.94 5.53 4.47 4.47 5.53 10.94 12l-6.47 6.47 1.06 1.06L12 13.06l6.47 6.47 1.06-1.06L13.06 12Z"></path></svg>';
    487485        $toggle_close_button_content = $should_display_icon_label ? $toggle_close_button_icon : __( 'Close' );
    488486        $toggle_aria_label_open      = $should_display_icon_label ? 'aria-label="' . __( 'Open menu' ) . '"' : ''; // Open button label.
     
    627625            $suffix = wp_scripts_get_suffix();
    628626            if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN ) {
    629                 $module_url = gutenberg_url( '/build/interactivity/navigation.min.js' );
     627                $module_url = gutenberg_url( '/build-module/block-library/navigation/view.min.js' );
    630628            }
    631629
     
    10841082        $fallback_blocks = ! empty( $maybe_fallback ) ? $maybe_fallback : $fallback_blocks;
    10851083
    1086         if ( function_exists( 'set_ignored_hooked_blocks_metadata' ) ) {
    1087             // Run Block Hooks algorithm to inject hooked blocks.
    1088             // We have to run it here because we need the post ID of the Navigation block to track ignored hooked blocks.
    1089             $markup = block_core_navigation_insert_hooked_blocks( $fallback_blocks, $navigation_post );
    1090             $blocks = parse_blocks( $markup );
    1091 
    1092             if ( isset( $blocks[0]['innerBlocks'] ) ) {
    1093                 $fallback_blocks = $blocks[0]['innerBlocks'];
    1094             }
     1084        // Run Block Hooks algorithm to inject hooked blocks.
     1085        // We have to run it here because we need the post ID of the Navigation block to track ignored hooked blocks.
     1086        $markup = block_core_navigation_insert_hooked_blocks( $fallback_blocks, $navigation_post );
     1087        $blocks = parse_blocks( $markup );
     1088
     1089        if ( isset( $blocks[0]['innerBlocks'] ) ) {
     1090            $fallback_blocks = $blocks[0]['innerBlocks'];
    10951091        }
    10961092    }
     
    16221618 * Do not add the `block_core_navigation_update_ignore_hooked_blocks_meta` filter in the following cases:
    16231619 * - If Core has added the `update_ignored_hooked_blocks_postmeta` filter already (WP >= 6.6);
    1624  * - or if the `set_ignored_hooked_blocks_metadata` function is unavailable (which is required for the filter to work. It was introduced by WP 6.5 but is not present in Gutenberg's WP 6.5 compatibility layer);
    16251620 * - or if the `$rest_insert_wp_navigation_core_callback` filter has already been added.
    16261621 */
    16271622if (
    16281623    ! has_filter( 'rest_pre_insert_wp_navigation', 'update_ignored_hooked_blocks_postmeta' ) &&
    1629     function_exists( 'set_ignored_hooked_blocks_metadata' ) &&
    16301624    ! has_filter( 'rest_pre_insert_wp_navigation', $rest_insert_wp_navigation_core_callback )
    16311625) {
    16321626    add_filter( 'rest_pre_insert_wp_navigation', 'block_core_navigation_update_ignore_hooked_blocks_meta' );
    1633 }
    1634 
    1635 /*
    1636  * Previous versions of Gutenberg were attaching the block_core_navigation_update_ignore_hooked_blocks_meta
    1637  * function to the `rest_insert_wp_navigation` _action_ (rather than the `rest_pre_insert_wp_navigation` _filter_).
    1638  * To avoid collisions, we need to remove the filter from that action if it's present.
    1639  */
    1640 if ( has_filter( 'rest_insert_wp_navigation', $rest_insert_wp_navigation_core_callback ) ) {
    1641     remove_filter( 'rest_insert_wp_navigation', $rest_insert_wp_navigation_core_callback );
    16421627}
    16431628
     
    16791664 * Do not add the `block_core_navigation_insert_hooked_blocks_into_rest_response` filter in the following cases:
    16801665 * - If Core has added the `insert_hooked_blocks_into_rest_response` filter already (WP >= 6.6);
    1681  * - or if the `set_ignored_hooked_blocks_metadata` function is unavailable (which is required for the filter to work. It was introduced by WP 6.5 but is not present in Gutenberg's WP 6.5 compatibility layer);
    16821666 * - or if the `$rest_prepare_wp_navigation_core_callback` filter has already been added.
    16831667 */
    16841668if (
    16851669    ! has_filter( 'rest_prepare_wp_navigation', 'insert_hooked_blocks_into_rest_response' ) &&
    1686     function_exists( 'set_ignored_hooked_blocks_metadata' ) &&
    16871670    ! has_filter( 'rest_prepare_wp_navigation', $rest_prepare_wp_navigation_core_callback )
    16881671) {
Note: See TracChangeset for help on using the changeset viewer.