Make WordPress Core


Ignore:
Timestamp:
06/27/2023 06:25:20 PM (3 years ago)
Author:
Bernhard Reiter
Message:

Editor: Update npm WordPress npm packages.

This fixes a fatal error in the Navigation block, which was due to a reference
to WP_Navigation_Fallback_Gutenberg that isn’t present in Core under that name.

Follow-up to [56065].
Props ramonjd, isabel_brison, dmsnell.
Fixes #58623.

File:
1 edited

Legend:

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

    r56065 r56076  
    9595     * @return string Submenu markup with the directives injected.
    9696     */
    97     function gutenberg_block_core_navigation_add_directives_to_submenu( $w, $block_attributes ) {
     97    function block_core_navigation_add_directives_to_submenu( $w, $block_attributes ) {
    9898        while ( $w->next_tag(
    9999            array(
     
    125125
    126126            // Iterate through subitems if exist.
    127             gutenberg_block_core_navigation_add_directives_to_submenu( $w, $block_attributes );
     127            block_core_navigation_add_directives_to_submenu( $w, $block_attributes );
    128128        }
    129129        return $w->get_updated_html();
     
    342342    $fallback_blocks = $registry->is_registered( 'core/page-list' ) ? $page_list_fallback : array();
    343343
    344     $navigation_post = WP_Navigation_Fallback_Gutenberg::get_fallback();
     344    if ( class_exists( 'WP_Navigation_Fallback' ) ) {
     345        $navigation_post = WP_Navigation_Fallback::get_fallback();
     346    } else {
     347        $navigation_post = Gutenberg_Navigation_Fallback::get_fallback();
     348    }
    345349
    346350    // Use the first non-empty Navigation as fallback if available.
     
    674678    if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN && $has_submenus && $should_load_view_script ) {
    675679        $w                 = new WP_HTML_Tag_Processor( $inner_blocks_html );
    676         $inner_blocks_html = gutenberg_block_core_navigation_add_directives_to_submenu( $w, $attributes );
     680        $inner_blocks_html = block_core_navigation_add_directives_to_submenu( $w, $attributes );
    677681    }
    678682
     
    837841 * Turns menu item data into a nested array of parsed blocks
    838842 *
     843 * @deprecated 6.3.0 Use WP_Navigation_Fallback::parse_blocks_from_menu_items() instead.
     844 *
    839845 * @param array $menu_items               An array of menu items that represent
    840846 *                                        an individual level of a menu.
     
    847853function block_core_navigation_parse_blocks_from_menu_items( $menu_items, $menu_items_by_parent_id ) {
    848854
    849     _deprecated_function( __FUNCTION__, '6.3.0', 'WP_Navigation_Fallback_Gutenberg::parse_blocks_from_menu_items' );
     855    _deprecated_function( __FUNCTION__, '6.3.0', 'WP_Navigation_Fallback::parse_blocks_from_menu_items' );
    850856
    851857    if ( empty( $menu_items ) ) {
     
    892898 * Get the classic navigation menu to use as a fallback.
    893899 *
     900 * @deprecated 6.3.0 Use WP_Navigation_Fallback::get_classic_menu_fallback() instead.
     901 *
    894902 * @return object WP_Term The classic navigation.
    895903 */
    896904function block_core_navigation_get_classic_menu_fallback() {
    897905
    898     _deprecated_function( __FUNCTION__, '6.3.0', 'WP_Navigation_Fallback_Gutenberg::get_classic_menu_fallback' );
     906    _deprecated_function( __FUNCTION__, '6.3.0', 'WP_Navigation_Fallback::get_classic_menu_fallback' );
    899907
    900908    $classic_nav_menus = wp_get_nav_menus();
     
    934942 * Converts a classic navigation to blocks.
    935943 *
     944 * @deprecated 6.3.0 Use WP_Navigation_Fallback::get_classic_menu_fallback_blocks() instead.
     945 *
    936946 * @param  object $classic_nav_menu WP_Term The classic navigation object to convert.
    937947 * @return array the normalized parsed blocks.
     
    939949function block_core_navigation_get_classic_menu_fallback_blocks( $classic_nav_menu ) {
    940950
    941     _deprecated_function( __FUNCTION__, '6.3.0', 'WP_Navigation_Fallback_Gutenberg::get_classic_menu_fallback_blocks' );
     951    _deprecated_function( __FUNCTION__, '6.3.0', 'WP_Navigation_Fallback::get_classic_menu_fallback_blocks' );
    942952
    943953    // BEGIN: Code that already exists in wp_nav_menu().
     
    972982
    973983/**
    974  * If there's a the classic menu then use it as a fallback.
     984 * If there's a classic menu then use it as a fallback.
     985 *
     986 * @deprecated 6.3.0 Use WP_Navigation_Fallback::create_classic_menu_fallback() instead.
    975987 *
    976988 * @return array the normalized parsed blocks.
     
    978990function block_core_navigation_maybe_use_classic_menu_fallback() {
    979991
    980     _deprecated_function( __FUNCTION__, '6.3.0', 'WP_Navigation_Fallback_Gutenberg::create_classic_menu_fallback' );
     992    _deprecated_function( __FUNCTION__, '6.3.0', 'WP_Navigation_Fallback::create_classic_menu_fallback' );
    981993
    982994    // See if we have a classic menu.
     
    10171029 * Finds the most recently published `wp_navigation` Post.
    10181030 *
     1031 * @deprecated 6.3.0 Use WP_Navigation_Fallback::get_most_recently_published_navigation() instead.
     1032 *
    10191033 * @return WP_Post|null the first non-empty Navigation or null.
    10201034 */
    10211035function block_core_navigation_get_most_recently_published_navigation() {
    10221036
    1023     _deprecated_function( __FUNCTION__, '6.3.0', 'WP_Navigation_Fallback_Gutenberg::get_most_recently_published_navigation' );
     1037    _deprecated_function( __FUNCTION__, '6.3.0', 'WP_Navigation_Fallback::get_most_recently_published_navigation' );
    10241038
    10251039    // Default to the most recently created menu.
Note: See TracChangeset for help on using the changeset viewer.