Skip to content

Commit

Permalink
Cherry-pick pre-6.3 Beta 1 bugfixes (#52011)
Browse files Browse the repository at this point in the history
* Restore sidebar in focus mode on Pattern click through in Browse Mode Library (#51897)

Brings back #51492

* [Command center]: Add preferences and keyboard shortcuts commands (#51862)

* [Command center]: Add preferences and keyboard shortcuts commands

* update labels

* [Site Editor]: Fix `library` command path (#51837)

* Updating social link attributes (#51997)

* Try: Update template titles (#51428)

* Update template titles

* Fix typo

Co-authored-by: Alex Stine <alex.stine@yourtechadvisors.com>

* Revert Index rename

* "front page" -> "homepage"

* Update 404

Page make more sense given the template appears in the Pages panel too.

* Front Page

* home title + description

* Revert Home name change, and move compat files

* separate code for wp versions

* update tests

---------

Co-authored-by: Alex Stine <alex.stine@yourtechadvisors.com>
Co-authored-by: ntsekouras <ntsekouras@outlook.com>

* Update text color (#51965)

* Modal: Add small top padding to the content so that avoid cutting off the visible outline when hovering items (#51829)

* Site Editor: Fix focus cutoff in add template modal

* Add padding-top to the modal content

* Remove unnecessary padding-top

* Remove unnecessary padding-top

* Update changelog

* Revert top padding from block patterns list

* Revert top padding from block patterns list

* Remove unnecessary changes

* Remove unnecessary changes

* Add CSS inline comment

* Change padding metrics

* Rest API: rename navigation fallback classes from WP_ to Gutenberg_ (#51959)

* The `WP_REST_Navigation_Fallback_Controller` class has been committed to core and therefore results in a naming conflict and unit test failures.
Ideally `WP_REST_Navigation_Fallback_Controller` should have been named `WP_REST_Navigation_Fallback_Controller_Gutenberg` and extended `WP_REST_Navigation_Fallback_Controller`.
But we can conditionally load the file instead.

* Renamed WP_Classic_To_Block_Menu_Converter to Gutenberg_Classic_To_Block_Menu_Converter
Load WP_REST_Navigation_Fallback_Controller dependencies in load.php

* Renamed all 6.3 classes to have the Gutenberg_ prefix. This should avoid compat errors and hopefully some confusion later.

* Also rename test files for completeness

* Updated deprecation notices to refer to Gutenberg classes

* Fix phpunit failures (#51950)

* Fix phpunit failures

* Add comment

* Update comment with actual reason this fix works

---------

Co-authored-by: Dave Smith <getdavemail@gmail.com>
Co-authored-by: Nik Tsekouras <ntsekouras@outlook.com>
Co-authored-by: Ramon <ramonjd@users.noreply.github.com>
Co-authored-by: James Koster <james@jameskoster.co.uk>
Co-authored-by: Alex Stine <alex.stine@yourtechadvisors.com>
Co-authored-by: Aki Hamano <54422211+t-hamano@users.noreply.github.com>
Co-authored-by: Robert Anderson <robert@noisysocks.com>
  • Loading branch information
8 people committed Jun 28, 2023
1 parent e3004c2 commit 7366294
Show file tree
Hide file tree
Showing 45 changed files with 507 additions and 367 deletions.
6 changes: 6 additions & 0 deletions docs/reference-guides/data/data-core-edit-post.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,8 @@ _Returns_

### isModalActive

> **Deprecated** since WP 6.3 use `core/interface` store's selector with the same name instead.
Returns true if a modal is active, or false otherwise.

_Parameters_
Expand Down Expand Up @@ -336,6 +338,8 @@ Returns an action object signalling that the user closed the sidebar.

### closeModal

> **Deprecated** since WP 6.3 use `core/interface` store's action with the same name instead.
Returns an action object signalling that the user closed a modal.

_Returns_
Expand Down Expand Up @@ -388,6 +392,8 @@ _Parameters_

### openModal

> **Deprecated** since WP 6.3 use `core/interface` store's action with the same name instead.
Returns an action object used in signalling that the user opened a modal.

_Parameters_
Expand Down
145 changes: 1 addition & 144 deletions lib/compat/wordpress-6.2/block-template-utils.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Temporary compatibility shims for features present in Gutenberg.
* This file should be removed when WordPress 6.1.0 becomes the lowest
* This file should be removed when WordPress 6.2.0 becomes the lowest
* supported version by this plugin.
*
* @package gutenberg
Expand Down Expand Up @@ -95,146 +95,3 @@ function gutenberg_get_template_hierarchy( $slug, $is_custom = false, $template_
$template_hierarchy[] = 'index';
return $template_hierarchy;
}


/**
* Updates the list of default template types, containing their
* localized titles and descriptions.
*
* We will only need to update `get_default_block_template_types` function.
*
* @param array $default_template_types The default template types.
*
* @return array The default template types.
*/
function gutenberg_get_default_block_template_types( $default_template_types ) {
if ( isset( $default_template_types['index'] ) ) {
$default_template_types['index'] = array(
'title' => _x( 'Index', 'Template name', 'gutenberg' ),
'description' => __(
'Used as a fallback template for all pages when a more specific template is not defined.',
'gutenberg'
),
);
}
if ( isset( $default_template_types['home'] ) ) {
$default_template_types['home'] = array(
'title' => _x( 'Home', 'Template name', 'gutenberg' ),
'description' => __(
'Displays the latest posts as either the site homepage or a custom page defined under reading settings. If it exists, the Front Page template overrides this template when posts are shown on the front page.',
'gutenberg'
),
);
}
if ( isset( $default_template_types['front-page'] ) ) {
$default_template_types['front-page'] = array(
'title' => _x( 'Front Page', 'Template name', 'gutenberg' ),
'description' => __(
"Displays your site's front page, whether it is set to display latest posts or a static page. The Front Page template takes precedence over all templates.",
'gutenberg'
),
);
}
if ( isset( $default_template_types['singular'] ) ) {
$default_template_types['singular'] = array(
'title' => _x( 'Singular', 'Template name', 'gutenberg' ),
'description' => __(
'Displays any single entry, such as a post or a page. This template will serve as a fallback when a more specific template (e.g., Single Post, Page, or Attachment) cannot be found.',
'gutenberg'
),
);
}
if ( isset( $default_template_types['single'] ) ) {
$default_template_types['single'] = array(
'title' => _x( 'Single', 'Template name', 'gutenberg' ),
'description' => __( 'Displays single posts on your website unless a custom template has been applied to that post or a dedicated template exists.', 'gutenberg' ),
);
}
if ( isset( $default_template_types['page'] ) ) {
$default_template_types['page'] = array(
'title' => _x( 'Page', 'Template name', 'gutenberg' ),
'description' => __( 'Display all static pages unless a custom template has been applied or a dedicated template exists.', 'gutenberg' ),
);
}
if ( isset( $default_template_types['archive'] ) ) {
$default_template_types['archive'] = array(
'title' => _x( 'Archive', 'Template name', 'gutenberg' ),
'description' => __(
'Displays any archive, including posts by a single author, category, tag, taxonomy, custom post type, and date. This template will serve as a fallback when more specific templates (e.g., Category or Tag) cannot be found.',
'gutenberg'
),
);
}
if ( isset( $default_template_types['author'] ) ) {
$default_template_types['author'] = array(
'title' => _x( 'Author', 'Template name', 'gutenberg' ),
'description' => __(
"Displays a single author's post archive. This template will serve as a fallback when a more a specific template (e.g., Author: Admin) cannot be found.",
'gutenberg'
),
);
}
if ( isset( $default_template_types['category'] ) ) {
$default_template_types['category'] = array(
'title' => _x( 'Category', 'Template name', 'gutenberg' ),
'description' => __(
'Displays a post category archive. This template will serve as a fallback when more specific template (e.g., Category: Recipes) cannot be found.',
'gutenberg'
),
);
}
if ( isset( $default_template_types['taxonomy'] ) ) {
$default_template_types['taxonomy'] = array(
'title' => _x( 'Taxonomy', 'Template name', 'gutenberg' ),
'description' => __(
'Displays a custom taxonomy archive. Like categories and tags, taxonomies have terms which you use to classify things. For example: a taxonomy named "Art" can have multiple terms, such as "Modern" and "18th Century." This template will serve as a fallback when a more specific template (e.g, Taxonomy: Art) cannot be found.',
'gutenberg'
),
);
}
if ( isset( $default_template_types['date'] ) ) {
$default_template_types['date'] = array(
'title' => _x( 'Date', 'Template name', 'gutenberg' ),
'description' => __( 'Displays a post archive when a specific date is visited (e.g., example.com/2023/).', 'gutenberg' ),
);
}
if ( isset( $default_template_types['tag'] ) ) {
$default_template_types['tag'] = array(
'title' => _x( 'Tag', 'Template name', 'gutenberg' ),
'description' => __(
'Displays a post tag archive. This template will serve as a fallback when more specific template (e.g., Tag: Pizza) cannot be found.',
'gutenberg'
),
);
}
if ( isset( $default_template_types['attachment'] ) ) {
$default_template_types['attachment'] = array(
'title' => _x( 'Media', 'Template name', 'gutenberg' ),
'description' => __( 'Displays when a visitor views the dedicated page that exists for any media attachment.', 'gutenberg' ),
);
}
if ( isset( $default_template_types['search'] ) ) {
$default_template_types['search'] = array(
'title' => _x( 'Search', 'Template name', 'gutenberg' ),
'description' => __( 'Displays when a visitor performs a search on your website.', 'gutenberg' ),
);
}
if ( isset( $default_template_types['privacy-policy'] ) ) {
$default_template_types['privacy-policy'] = array(
'title' => _x( 'Privacy Policy', 'Template name', 'gutenberg' ),
'description' => __(
"Displays your site's Privacy Policy page.",
'gutenberg'
),
);
}
if ( isset( $default_template_types['404'] ) ) {
$default_template_types['404'] = array(
'title' => _x( '404', 'Template name', 'gutenberg' ),
'description' => __( 'Displays when a visitor views a non-existent page, such as a dead link or a mistyped URL.', 'gutenberg' ),
);
}

return $default_template_types;
}
add_filter( 'default_template_types', 'gutenberg_get_default_block_template_types', 10 );
150 changes: 150 additions & 0 deletions lib/compat/wordpress-6.3/block-template-utils.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
<?php
/**
* Temporary compatibility shims for features present in Gutenberg.
* This file should be removed when WordPress 6.3.0 becomes the lowest
* supported version by this plugin.
*
* @package gutenberg
*/

/**
* Updates the list of default template types, containing their
* localized titles and descriptions.
*
* We will only need to update `get_default_block_template_types` function.
*
* @param array $default_template_types The default template types.
*
* @return array The default template types.
*/
function gutenberg_get_default_block_template_types( $default_template_types ) {
if ( isset( $default_template_types['index'] ) ) {
$default_template_types['index'] = array(
'title' => _x( 'Index', 'Template name', 'gutenberg' ),
'description' => __(
'Used as a fallback template for all pages when a more specific template is not defined.',
'gutenberg'
),
);
}
if ( isset( $default_template_types['home'] ) ) {
$default_template_types['home'] = array(
'title' => _x( 'Home', 'Template name', 'gutenberg' ),
'description' => __(
'Displays the latest posts as either the site homepage or as the "Posts page" as defined under reading settings. If it exists, the Front Page template overrides this template when posts are shown on the homepage.',
'gutenberg'
),
);
}
if ( isset( $default_template_types['front-page'] ) ) {
$default_template_types['front-page'] = array(
'title' => _x( 'Front Page', 'Template name', 'gutenberg' ),
'description' => __(
"Displays your site's homepage, whether it is set to display latest posts or a static page. The Front Page template takes precedence over all templates.",
'gutenberg'
),
);
}
if ( isset( $default_template_types['singular'] ) ) {
$default_template_types['singular'] = array(
'title' => _x( 'Single Entries', 'Template name', 'gutenberg' ),
'description' => __(
'Displays any single entry, such as a post or a page. This template will serve as a fallback when a more specific template (e.g., Single Post, Page, or Attachment) cannot be found.',
'gutenberg'
),
);
}
if ( isset( $default_template_types['single'] ) ) {
$default_template_types['single'] = array(
'title' => _x( 'Single Posts', 'Template name', 'gutenberg' ),
'description' => __( 'Displays single posts on your website unless a custom template has been applied to that post or a dedicated template exists.', 'gutenberg' ),
);
}
if ( isset( $default_template_types['page'] ) ) {
$default_template_types['page'] = array(
'title' => _x( 'Pages', 'Template name', 'gutenberg' ),
'description' => __( 'Display all static pages unless a custom template has been applied or a dedicated template exists.', 'gutenberg' ),
);
}
if ( isset( $default_template_types['archive'] ) ) {
$default_template_types['archive'] = array(
'title' => _x( 'All Archives', 'Template name', 'gutenberg' ),
'description' => __(
'Displays any archive, including posts by a single author, category, tag, taxonomy, custom post type, and date. This template will serve as a fallback when more specific templates (e.g., Category or Tag) cannot be found.',
'gutenberg'
),
);
}
if ( isset( $default_template_types['author'] ) ) {
$default_template_types['author'] = array(
'title' => _x( 'Author Archives', 'Template name', 'gutenberg' ),
'description' => __(
"Displays a single author's post archive. This template will serve as a fallback when a more a specific template (e.g., Author: Admin) cannot be found.",
'gutenberg'
),
);
}
if ( isset( $default_template_types['category'] ) ) {
$default_template_types['category'] = array(
'title' => _x( 'Category Archives', 'Template name', 'gutenberg' ),
'description' => __(
'Displays a post category archive. This template will serve as a fallback when more specific template (e.g., Category: Recipes) cannot be found.',
'gutenberg'
),
);
}
if ( isset( $default_template_types['taxonomy'] ) ) {
$default_template_types['taxonomy'] = array(
'title' => _x( 'Taxonomy', 'Template name', 'gutenberg' ),
'description' => __(
'Displays a custom taxonomy archive. Like categories and tags, taxonomies have terms which you use to classify things. For example: a taxonomy named "Art" can have multiple terms, such as "Modern" and "18th Century." This template will serve as a fallback when a more specific template (e.g, Taxonomy: Art) cannot be found.',
'gutenberg'
),
);
}
if ( isset( $default_template_types['date'] ) ) {
$default_template_types['date'] = array(
'title' => _x( 'Date Archives', 'Template name', 'gutenberg' ),
'description' => __( 'Displays a post archive when a specific date is visited (e.g., example.com/2023/).', 'gutenberg' ),
);
}
if ( isset( $default_template_types['tag'] ) ) {
$default_template_types['tag'] = array(
'title' => _x( 'Tag Archives', 'Template name', 'gutenberg' ),
'description' => __(
'Displays a post tag archive. This template will serve as a fallback when more specific template (e.g., Tag: Pizza) cannot be found.',
'gutenberg'
),
);
}
if ( isset( $default_template_types['attachment'] ) ) {
$default_template_types['attachment'] = array(
'title' => _x( 'Attachment Pages', 'Template name', 'gutenberg' ),
'description' => __( 'Displays when a visitor views the dedicated page that exists for any media attachment.', 'gutenberg' ),
);
}
if ( isset( $default_template_types['search'] ) ) {
$default_template_types['search'] = array(
'title' => _x( 'Search Results', 'Template name', 'gutenberg' ),
'description' => __( 'Displays when a visitor performs a search on your website.', 'gutenberg' ),
);
}
if ( isset( $default_template_types['privacy-policy'] ) ) {
$default_template_types['privacy-policy'] = array(
'title' => _x( 'Privacy Policy', 'Template name', 'gutenberg' ),
'description' => __(
"Displays your site's Privacy Policy page.",
'gutenberg'
),
);
}
if ( isset( $default_template_types['404'] ) ) {
$default_template_types['404'] = array(
'title' => _x( 'Page: 404', 'Template name', 'gutenberg' ),
'description' => __( 'Displays when a visitor views a non-existent page, such as a dead link or a mistyped URL.', 'gutenberg' ),
);
}

return $default_template_types;
}
add_filter( 'default_template_types', 'gutenberg_get_default_block_template_types', 10 );
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* WP_Classic_To_Block_Menu_Converter class
* Gutenberg_Classic_To_Block_Menu_Converter class
*
* @package gutenberg
* @since 6.3.0
Expand All @@ -11,7 +11,7 @@
*
* @access public
*/
class WP_Classic_To_Block_Menu_Converter {
class Gutenberg_Classic_To_Block_Menu_Converter {

/**
* Converts a Classic Menu to blocks.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* WP_Navigation_Fallback_Gutenberg class
* Gutenberg_Navigation_Fallback class
*
* Manages fallback behavior for Navigation menus.
*
Expand All @@ -9,17 +9,12 @@
* @since 6.3.0
*/

/**
* Import dependencies.
*/
require __DIR__ . '/class-wp-classic-to-block-menu-converter.php';

/**
* Manages fallback behavior for Navigation menus.
*
* @access public
*/
class WP_Navigation_Fallback_Gutenberg {
class Gutenberg_Navigation_Fallback {

/**
* Gets (and/or creates) an appropriate fallback Navigation Menu.
Expand Down Expand Up @@ -92,7 +87,7 @@ private static function create_classic_menu_fallback() {
}

// If there is a classic menu then convert it to blocks.
$classic_nav_menu_blocks = WP_Classic_To_Block_Menu_Converter::convert( $classic_nav_menu );
$classic_nav_menu_blocks = Gutenberg_Classic_To_Block_Menu_Converter::convert( $classic_nav_menu );

if ( empty( $classic_nav_menu_blocks ) ) {
return new WP_Error( 'cannot_convert_classic_menu', __( 'Unable to convert Classic Menu to blocks.', 'gutenberg' ) );
Expand Down
Loading

0 comments on commit 7366294

Please sign in to comment.