diff --git a/packages/block-library/src/latest-posts/index.php b/packages/block-library/src/latest-posts/index.php index 746133ec7a898..c7a37fe0fe31f 100644 --- a/packages/block-library/src/latest-posts/index.php +++ b/packages/block-library/src/latest-posts/index.php @@ -51,7 +51,7 @@ function render_block_core_latest_posts( $attributes ) { $filter_latest_posts_excerpt_more = static function( $more ) use ( $attributes ) { $use_excerpt = 'excerpt' === $attributes['displayPostContentRadio']; /* translators: %1$s is a URL to a post, excerpt truncation character, default … */ - return $use_excerpt ? sprintf( __( ' … Read more', 'gutenberg' ), esc_url( get_permalink() ) ) : $more; + return $use_excerpt ? sprintf( __( ' … Read more' ), esc_url( get_permalink() ) ) : $more; }; add_filter( 'excerpt_more', $filter_latest_posts_excerpt_more ); diff --git a/packages/block-library/src/navigation/index.php b/packages/block-library/src/navigation/index.php index d16de821b4712..6de09f8dd36aa 100644 --- a/packages/block-library/src/navigation/index.php +++ b/packages/block-library/src/navigation/index.php @@ -94,7 +94,7 @@ function block_core_navigation_sort_menu_items_by_parent_id( $menu_items ) { * * @return string Submenu markup with the directives injected. */ - function gutenberg_block_core_navigation_add_directives_to_submenu( $w, $block_attributes ) { + function block_core_navigation_add_directives_to_submenu( $w, $block_attributes ) { while ( $w->next_tag( array( 'tag_name' => 'LI', @@ -124,7 +124,7 @@ function gutenberg_block_core_navigation_add_directives_to_submenu( $w, $block_a }; // Iterate through subitems if exist. - gutenberg_block_core_navigation_add_directives_to_submenu( $w, $block_attributes ); + block_core_navigation_add_directives_to_submenu( $w, $block_attributes ); } return $w->get_updated_html(); }; @@ -341,7 +341,11 @@ function block_core_navigation_get_fallback_blocks() { // If `core/page-list` is not registered then return empty blocks. $fallback_blocks = $registry->is_registered( 'core/page-list' ) ? $page_list_fallback : array(); - $navigation_post = Gutenberg_Navigation_Fallback::get_fallback(); + if ( class_exists( 'WP_Navigation_Fallback' ) ) { + $navigation_post = WP_Navigation_Fallback::get_fallback(); + } else { + $navigation_post = Gutenberg_Navigation_Fallback::get_fallback(); + } // Use the first non-empty Navigation as fallback if available. if ( $navigation_post ) { @@ -673,7 +677,7 @@ function render_block_core_navigation( $attributes, $content, $block ) { // Add directives to the submenu if needed. if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN && $has_submenus && $should_load_view_script ) { $w = new WP_HTML_Tag_Processor( $inner_blocks_html ); - $inner_blocks_html = gutenberg_block_core_navigation_add_directives_to_submenu( $w, $attributes ); + $inner_blocks_html = block_core_navigation_add_directives_to_submenu( $w, $attributes ); } $modal_unique_id = wp_unique_id( 'modal-' ); @@ -836,6 +840,8 @@ function block_core_navigation_typographic_presets_backcompatibility( $parsed_bl /** * Turns menu item data into a nested array of parsed blocks * + * @deprecated 6.3.0 Use WP_Navigation_Fallback::parse_blocks_from_menu_items() instead. + * * @param array $menu_items An array of menu items that represent * an individual level of a menu. * @param array $menu_items_by_parent_id An array keyed by the id of the @@ -846,7 +852,7 @@ function block_core_navigation_typographic_presets_backcompatibility( $parsed_bl */ function block_core_navigation_parse_blocks_from_menu_items( $menu_items, $menu_items_by_parent_id ) { - _deprecated_function( __FUNCTION__, '6.3.0', 'Gutenberg_Navigation_Fallback::parse_blocks_from_menu_items' ); + _deprecated_function( __FUNCTION__, '6.3.0', 'WP_Navigation_Fallback::parse_blocks_from_menu_items' ); if ( empty( $menu_items ) ) { return array(); @@ -891,11 +897,13 @@ function block_core_navigation_parse_blocks_from_menu_items( $menu_items, $menu_ /** * Get the classic navigation menu to use as a fallback. * + * @deprecated 6.3.0 Use WP_Navigation_Fallback::get_classic_menu_fallback() instead. + * * @return object WP_Term The classic navigation. */ function block_core_navigation_get_classic_menu_fallback() { - _deprecated_function( __FUNCTION__, '6.3.0', 'Gutenberg_Navigation_Fallback::get_classic_menu_fallback' ); + _deprecated_function( __FUNCTION__, '6.3.0', 'WP_Navigation_Fallback::get_classic_menu_fallback' ); $classic_nav_menus = wp_get_nav_menus(); @@ -933,12 +941,14 @@ static function( $a, $b ) { /** * Converts a classic navigation to blocks. * + * @deprecated 6.3.0 Use WP_Navigation_Fallback::get_classic_menu_fallback_blocks() instead. + * * @param object $classic_nav_menu WP_Term The classic navigation object to convert. * @return array the normalized parsed blocks. */ function block_core_navigation_get_classic_menu_fallback_blocks( $classic_nav_menu ) { - _deprecated_function( __FUNCTION__, '6.3.0', 'Gutenberg_Navigation_Fallback::get_classic_menu_fallback_blocks' ); + _deprecated_function( __FUNCTION__, '6.3.0', 'WP_Navigation_Fallback::get_classic_menu_fallback_blocks' ); // BEGIN: Code that already exists in wp_nav_menu(). $menu_items = wp_get_nav_menu_items( $classic_nav_menu->term_id, array( 'update_post_term_cache' => false ) ); @@ -971,13 +981,15 @@ function block_core_navigation_get_classic_menu_fallback_blocks( $classic_nav_me } /** - * If there's a the classic menu then use it as a fallback. + * If there's a classic menu then use it as a fallback. + * + * @deprecated 6.3.0 Use WP_Navigation_Fallback::create_classic_menu_fallback() instead. * * @return array the normalized parsed blocks. */ function block_core_navigation_maybe_use_classic_menu_fallback() { - _deprecated_function( __FUNCTION__, '6.3.0', 'Gutenberg_Navigation_Fallback::create_classic_menu_fallback' ); + _deprecated_function( __FUNCTION__, '6.3.0', 'WP_Navigation_Fallback::create_classic_menu_fallback' ); // See if we have a classic menu. $classic_nav_menu = block_core_navigation_get_classic_menu_fallback(); @@ -1016,11 +1028,13 @@ function block_core_navigation_maybe_use_classic_menu_fallback() { /** * Finds the most recently published `wp_navigation` Post. * + * @deprecated 6.3.0 Use WP_Navigation_Fallback::get_most_recently_published_navigation() instead. + * * @return WP_Post|null the first non-empty Navigation or null. */ function block_core_navigation_get_most_recently_published_navigation() { - _deprecated_function( __FUNCTION__, '6.3.0', 'Gutenberg_Navigation_Fallback::get_most_recently_published_navigation' ); + _deprecated_function( __FUNCTION__, '6.3.0', 'WP_Navigation_Fallback::get_most_recently_published_navigation' ); // Default to the most recently created menu. $parsed_args = array(