Making WordPress.org

Changeset 11312


Ignore:
Timestamp:
11/04/2021 06:13:10 AM (3 years ago)
Author:
SergeyBiryukov
Message:

Plugin Directory: Remove extra placeholder in the title on Edit Plugin screen.

Make sure the title replacement to include the plugin name only runs once in the appropriate context.

Follow-up to [2655], [2829], [WP51969].

Props Ipstenu, SergeyBiryukov.
Fixes #5940.

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-customizations.php

    r10437 r11312  
    4848        // Admin Metaboxes
    4949        add_action( 'add_meta_boxes', array( $this, 'register_admin_metaboxes' ), 10, 2 );
    50         add_action( 'do_meta_boxes', array( $this, 'replace_title_global' ) );
     50        add_action( 'do_meta_boxes', array( $this, 'replace_title_global' ), 10, 2 );
    5151
    5252        add_filter( 'postmeta_form_keys', array( $this, 'postmeta_form_keys' ) );
     
    7070     * @global string $title The wp-admin title variable.
    7171     *
    72      * @param string $post_type The post type of the current page
     72     * @param string $post_type The post type of the current page.
     73     * @param string $context   Meta box context. Possible values include 'normal', 'advanced', 'side'.
    7374     * @return void.
    7475     */
    75     public function replace_title_global( $post_type ) {
     76    public function replace_title_global( $post_type, $context ) {
    7677        global $title;
    7778
    78         if ( 'plugin' === $post_type ) {
    79             $title = sprintf( $title, get_the_title() ); // esc_html() on output
     79        if ( 'plugin' === $post_type && 'normal' === $context ) {
     80            $post_type_object = get_post_type_object( $post_type );
     81            $title            = sprintf( '%1$s %2$s', $post_type_object->labels->edit_item, get_the_title() ); // esc_html() on output
    8082        }
    8183    }
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php

    r11162 r11312  
    171171
    172172                // Context only available in admin, not in toolbar.
    173                 'edit_item'          => is_admin() ? __( 'Editing Plugin: %s', 'wporg-plugins' ) : __( 'Edit Plugin', 'wporg-plugins' ),
     173                'edit_item'          => is_admin() ? __( 'Editing Plugin:', 'wporg-plugins' ) : __( 'Edit Plugin', 'wporg-plugins' ),
    174174            ),
    175175            'description'  => __( 'A Repo Plugin', 'wporg-plugins' ),
Note: See TracChangeset for help on using the changeset viewer.