Make WordPress Core

Changeset 53908


Ignore:
Timestamp:
08/19/2022 01:09:12 PM (4 years ago)
Author:
SergeyBiryukov
Message:

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.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/wp/theme.js

    r53907 r53908  
    16951695        // Create a new collection with the proper theme data
    16961696        // for each section.
    1697         if ( 'blockthemes' === section ) {
     1697        if ( 'block-themes' === section ) {
    16981698            // Get the themes by sending Ajax POST request to api.wordpress.org/themes
    16991699            // or searching the local cache.
  • trunk/src/wp-admin/theme-install.php

    r53907 r53908  
    9191     * Possible hook names include:
    9292     *
    93      *  - `install_themes_pre_blockthemes`
     93     *  - `install_themes_pre_block-themes`
    9494     *  - `install_themes_pre_dashboard`
    9595     *  - `install_themes_pre_featured`
     
    100100     *
    101101     * @since 2.8.0
    102      * @since 6.1.0 Added `install_themes_pre_blockthemes` hook name.
     102     * @since 6.1.0 Added the `install_themes_pre_block-themes` hook name.
    103103     */
    104104    do_action( "install_themes_pre_{$tab}" );
     
    188188            <li><a href="#" data-sort="popular"><?php _ex( 'Popular', 'themes' ); ?></a></li>
    189189            <li><a href="#" data-sort="new"><?php _ex( 'Latest', 'themes' ); ?></a></li>
    190             <li><a href="#" data-sort="blockthemes"><?php _ex( 'Block Themes', 'themes' ); ?></a></li>
     190            <li><a href="#" data-sort="block-themes"><?php _ex( 'Block Themes', 'themes' ); ?></a></li>
    191191            <li><a href="#" data-sort="favorites"><?php _ex( 'Favorites', 'themes' ); ?></a></li>
    192192        </ul>
     
    267267     * Possible hook names include:
    268268     *
    269      *  - `install_themes_blockthemes`
     269     *  - `install_themes_block-themes`
    270270     *  - `install_themes_dashboard`
    271271     *  - `install_themes_featured`
     
    276276     *
    277277     * @since 2.8.0
    278      * @since 6.1.0 Added `install_themes_blockthemes` hook name.
     278     * @since 6.1.0 Added the `install_themes_block-themes` hook name.
    279279     *
    280280     * @param int $paged Number of the current page of results being viewed.
Note: See TracChangeset for help on using the changeset viewer.