Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Removes references to execution code referencing gutenberg where poss…
…ible to avoid conflicts with Core.
  • Loading branch information
ramonjd committed Jun 27, 2023
commit 696d728b28c89f3fd63c2c4a714c327d19eedce2
2 changes: 1 addition & 1 deletion packages/block-library/src/latest-posts/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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( __( ' … <a href="%1$s" rel="noopener noreferrer">Read more</a>', 'gutenberg' ), esc_url( get_permalink() ) ) : $more;
return $use_excerpt ? sprintf( __( ' … <a href="%1$s" rel="noopener noreferrer">Read more</a>' ), esc_url( get_permalink() ) ) : $more;
};

add_filter( 'excerpt_more', $filter_latest_posts_excerpt_more );
Expand Down
16 changes: 10 additions & 6 deletions packages/block-library/src/navigation/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' ) ) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure if I this should be

if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN ) {

Same effect, just convention?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd go with the class_exists check, since the compat layer changes over time (and is thus not directly equivalent to the presence of the plugin).

$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 ) {
Expand Down Expand Up @@ -846,7 +850,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();
Expand Down Expand Up @@ -895,7 +899,7 @@ function block_core_navigation_parse_blocks_from_menu_items( $menu_items, $menu_
*/
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();

Expand Down Expand Up @@ -938,7 +942,7 @@ static function( $a, $b ) {
*/
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 ) );
Expand Down Expand Up @@ -977,7 +981,7 @@ function block_core_navigation_get_classic_menu_fallback_blocks( $classic_nav_me
*/
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();
Expand Down Expand Up @@ -1020,7 +1024,7 @@ function block_core_navigation_maybe_use_classic_menu_fallback() {
*/
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(
Expand Down