Themes: Include a hyphen in the Block Themes tab key on Add Themes screen.

This better matches the tab name and changes the associated action hooks to:

* `install_themes_pre_block-themes` (fires before the tab is rendered)
* `install_themes_block-themes` (fires at the top the tab)

While including a mix of underscores and hyphens in a hook name is not quite typical for core, it does have a precedent and brings more consistency with similar filters on Add Plugin screen:

* `install_plugins_pre_plugin-information`
* `install_plugins_plugin-information`

Follow-up to [53906], [53907].

Fixes #56283.

git-svn-id: https://develop.svn.wordpress.org/trunk@53908 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2022-08-19 13:09:12 +00:00
parent 459e5d52ac
commit 74fa60b30a
2 changed files with 6 additions and 6 deletions

View File

@ -1694,7 +1694,7 @@ themes.view.Installer = themes.view.Appearance.extend({
browse: function( section ) {
// Create a new collection with the proper theme data
// for each section.
if ( 'blockthemes' === section ) {
if ( 'block-themes' === section ) {
// Get the themes by sending Ajax POST request to api.wordpress.org/themes
// or searching the local cache.
this.collection.query( { tag: 'full-site-editing' } );

View File

@ -90,7 +90,7 @@ if ( $tab ) {
*
* Possible hook names include:
*
* - `install_themes_pre_blockthemes`
* - `install_themes_pre_block-themes`
* - `install_themes_pre_dashboard`
* - `install_themes_pre_featured`
* - `install_themes_pre_new`
@ -99,7 +99,7 @@ if ( $tab ) {
* - `install_themes_pre_upload`
*
* @since 2.8.0
* @since 6.1.0 Added `install_themes_pre_blockthemes` hook name.
* @since 6.1.0 Added the `install_themes_pre_block-themes` hook name.
*/
do_action( "install_themes_pre_{$tab}" );
}
@ -187,7 +187,7 @@ require_once ABSPATH . 'wp-admin/admin-header.php';
<ul class="filter-links">
<li><a href="#" data-sort="popular"><?php _ex( 'Popular', 'themes' ); ?></a></li>
<li><a href="#" data-sort="new"><?php _ex( 'Latest', 'themes' ); ?></a></li>
<li><a href="#" data-sort="blockthemes"><?php _ex( 'Block Themes', 'themes' ); ?></a></li>
<li><a href="#" data-sort="block-themes"><?php _ex( 'Block Themes', 'themes' ); ?></a></li>
<li><a href="#" data-sort="favorites"><?php _ex( 'Favorites', 'themes' ); ?></a></li>
</ul>
@ -266,7 +266,7 @@ if ( $tab ) {
*
* Possible hook names include:
*
* - `install_themes_blockthemes`
* - `install_themes_block-themes`
* - `install_themes_dashboard`
* - `install_themes_featured`
* - `install_themes_new`
@ -275,7 +275,7 @@ if ( $tab ) {
* - `install_themes_upload`
*
* @since 2.8.0
* @since 6.1.0 Added `install_themes_blockthemes` hook name.
* @since 6.1.0 Added the `install_themes_block-themes` hook name.
*
* @param int $paged Number of the current page of results being viewed.
*/