WordPress.org

Make WordPress Core

Changeset 52406


Ignore:
Timestamp:
12/21/2021 08:04:54 PM (4 weeks ago)
Author:
hellofromTonya
Message:

Administration: Add "File" to Theme/Plugin Editor menu names and relocate "Plugin File Editor" to Tools for block themes.

[52232] relocated the Theme Editor menu item from Appearance to Tools for block themes. This commit relocates the Plugin Editor menu item from Plugins to Tools for block themes for a consistent workflow.

Both the Theme Editor and Plugin Editor menu items are renamed to "Theme File Editor" and "Plugin File Editor" respectively. Why? To better identify their purpose, i.e. to directly edit the code in the theme or plugin files. The rename is not limited to only block themes.

Follow-up to [52232].

Props poena, annezazu, audrasjb, clorith, courane01, costdev, dryanpress, desrosj, hellofromTonya, ipstenu, jameskoster, joen, johnbillion, joyously, manfcarlo, marybaum, pbiron, SergeyBiryukov, walbo, youknowriad.
Fixes #54382.

Location:
trunk/src
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/admin/common.js

    r52285 r52406  
    13101310
    13111311    /**
    1312      * Handles tab keypresses in theme and plugin editor textareas.
     1312     * Handles tab keypresses in theme and plugin file editor textareas.
    13131313     *
    13141314     * @param {Event} e The event object.
  • trunk/src/wp-admin/css/common.css

    r51891 r52406  
    31463146}
    31473147
    3148 /* Theme/Plugin Editor */
     3148/* Theme/Plugin file editor */
    31493149.alignleft h2 {
    31503150    margin: 0;
     
    31993199
    32003200/*
    3201  * Styles for Theme and Plugin editors.
     3201 * Styles for Theme and Plugin file editors.
    32023202 */
    32033203
  • trunk/src/wp-admin/includes/deprecated.php

    r52285 r52406  
    204204
    205205/**
    206  * Adds JavaScript required to make CodePress work on the theme/plugin editors.
     206 * Adds JavaScript required to make CodePress work on the theme/plugin file editors.
    207207 *
    208208 * @since 2.8.0
  • trunk/src/wp-admin/includes/file.php

    r52351 r52406  
    224224
    225225    /**
    226      * Filters the list of file types allowed for editing in the plugin editor.
     226     * Filters the list of file types allowed for editing in the plugin file editor.
    227227     *
    228228     * @since 2.8.0
     
    283283
    284284    /**
    285      * Filters the list of file types allowed for editing in the theme editor.
     285     * Filters the list of file types allowed for editing in the theme file editor.
    286286     *
    287287     * @since 4.4.0
  • trunk/src/wp-admin/includes/misc.php

    r51837 r52406  
    310310
    311311/**
    312  * Update the "recently-edited" file for the plugin or theme editor.
     312 * Update the "recently-edited" file for the plugin or theme file editor.
    313313 *
    314314 * @since 1.5.0
     
    333333
    334334/**
    335  * Makes a tree structure for the theme editor's file list.
     335 * Makes a tree structure for the theme file editor's file list.
    336336 *
    337337 * @since 4.9.0
     
    355355
    356356/**
    357  * Outputs the formatted file list for the theme editor.
     357 * Outputs the formatted file list for the theme file editor.
    358358 *
    359359 * @since 4.9.0
     
    426426
    427427/**
    428  * Makes a tree structure for the plugin editor's file list.
     428 * Makes a tree structure for the plugin file editor's file list.
    429429 *
    430430 * @since 4.9.0
     
    448448
    449449/**
    450  * Outputs the formatted file list for the plugin editor.
     450 * Outputs the formatted file list for the plugin file editor.
    451451 *
    452452 * @since 4.9.0
  • trunk/src/wp-admin/includes/theme.php

    r52371 r52406  
    147147
    148148/**
    149  * Tidies a filename for url display by the theme editor.
     149 * Tidies a filename for url display by the theme file editor.
    150150 *
    151151 * @since 2.9.0
  • trunk/src/wp-admin/menu.php

    r52330 r52406  
    242242unset( $appearance_cap );
    243243
    244 // Add 'Theme Editor' to the bottom of the Appearance menu.
     244// Add 'Theme File Editor' to the bottom of the Appearance (non-block themes) or Tools (block themes) menu.
    245245if ( ! is_multisite() ) {
    246246    // Must use API on the admin_menu hook, direct modification is only possible on/before the _admin_menu hook.
     
    248248}
    249249/**
    250  * Adds the 'Theme Editor' link to the bottom of the Appearance or Tools menu.
     250 * Adds the 'Theme File Editor' menu item to the bottom of the Appearance (non-block themes)
     251 * or Tools (block themes) menu.
    251252 *
    252253 * @access private
    253254 * @since 3.0.0
    254  * @since 5.9.0 'Theme Editor' link has moved to the Tools menu when a block theme is active.
     255 * @since 5.9.0 Renamed 'Theme Editor' to 'Theme File Editor'.
     256 *              Relocates to Tools for block themes.
    255257 */
    256258function _add_themes_utility_last() {
    257259    add_submenu_page(
    258260        wp_is_block_theme() ? 'tools.php' : 'themes.php',
    259         __( 'Theme Editor' ),
    260         __( 'Theme Editor' ),
     261        __( 'Theme File Editor' ),
     262        __( 'Theme File Editor' ),
    261263        'edit_themes',
    262264        'theme-editor.php'
     265    );
     266}
     267
     268/**
     269 * Adds the 'Plugin File Editor' menu item after the 'Themes File Editor' in Tools
     270 * for block themes.
     271 *
     272 * @access private
     273 * @since 5.9.0
     274 */
     275function _add_plugin_file_editor_to_tools() {
     276    if ( ! wp_is_block_theme() ) {
     277        return;
     278    }
     279    add_submenu_page(
     280        'tools.php',
     281        __( 'Plugin File Editor' ),
     282        __( 'Plugin File Editor' ),
     283        'edit_plugins',
     284        'plugin-editor.php'
    263285    );
    264286}
     
    284306    /* translators: Add new plugin. */
    285307    $submenu['plugins.php'][10] = array( _x( 'Add New', 'plugin' ), 'install_plugins', 'plugin-install.php' );
    286     $submenu['plugins.php'][15] = array( __( 'Plugin Editor' ), 'edit_plugins', 'plugin-editor.php' );
     308    if ( wp_is_block_theme() ) {
     309        // Place the menu item below the Theme File Editor menu item.
     310        add_action( 'admin_menu', '_add_plugin_file_editor_to_tools', 101 );
     311    } else {
     312        $submenu['plugins.php'][15] = array( __( 'Plugin File Editor' ), 'edit_plugins', 'plugin-editor.php' );
     313    }
    287314}
    288315
  • trunk/src/wp-admin/network/menu.php

    r47198 r52406  
    8080$submenu['themes.php'][5]  = array( __( 'Installed Themes' ), 'manage_network_themes', 'themes.php' );
    8181$submenu['themes.php'][10] = array( _x( 'Add New', 'theme' ), 'install_themes', 'theme-install.php' );
    82 $submenu['themes.php'][15] = array( __( 'Theme Editor' ), 'edit_themes', 'theme-editor.php' );
     82$submenu['themes.php'][15] = array( __( 'Theme File Editor' ), 'edit_themes', 'theme-editor.php' );
    8383
    8484if ( current_user_can( 'update_plugins' ) && $update_data['counts']['plugins'] ) {
     
    105105$submenu['plugins.php'][5]  = array( __( 'Installed Plugins' ), 'manage_network_plugins', 'plugins.php' );
    106106$submenu['plugins.php'][10] = array( _x( 'Add New', 'plugin' ), 'install_plugins', 'plugin-install.php' );
    107 $submenu['plugins.php'][15] = array( __( 'Plugin Editor' ), 'edit_plugins', 'plugin-editor.php' );
     107$submenu['plugins.php'][15] = array( __( 'Plugin File Editor' ), 'edit_plugins', 'plugin-editor.php' );
    108108
    109109$menu[25] = array( __( 'Settings' ), 'manage_network_options', 'settings.php', '', 'menu-top menu-icon-settings', 'menu-settings', 'dashicons-admin-settings' );
  • trunk/src/wp-admin/network/plugin-editor.php

    r47198 r52406  
    11<?php
    22/**
    3  * Plugin editor network administration panel.
     3 * Plugin file editor network administration panel.
    44 *
    55 * @package WordPress
  • trunk/src/wp-admin/network/theme-editor.php

    r47198 r52406  
    11<?php
    22/**
    3  * Theme editor network administration panel.
     3 * Theme file editor network administration panel.
    44 *
    55 * @package WordPress
  • trunk/src/wp-admin/plugin-editor.php

    r51979 r52406  
    11<?php
    22/**
    3  * Edit plugin editor administration panel.
     3 * Edit plugin file editor administration panel.
    44 *
    55 * @package WordPress
     
    125125        'title'   => __( 'Overview' ),
    126126        'content' =>
    127                 '<p>' . __( 'You can use the plugin editor to make changes to any of your plugins&#8217; individual PHP files. Be aware that if you make changes, plugins updates will overwrite your customizations.' ) . '</p>' .
     127                '<p>' . __( 'You can use the plugin file editor to make changes to any of your plugins&#8217; individual PHP files. Be aware that if you make changes, plugins updates will overwrite your customizations.' ) . '</p>' .
    128128                '<p>' . __( 'Choose a plugin to edit from the dropdown menu and click the Select button. Click once on any file name to load it in the editor, and make your changes. Don&#8217;t forget to save your changes (Update File) when you&#8217;re finished.' ) . '</p>' .
    129129                '<p>' . __( 'The Documentation menu below the editor lists the PHP functions recognized in the plugin file. Clicking Look Up takes you to a web page about that particular function.' ) . '</p>' .
  • trunk/src/wp-admin/theme-editor.php

    r52330 r52406  
    11<?php
    22/**
    3  * Theme editor administration panel.
     3 * Theme file editor administration panel.
    44 *
    55 * @package WordPress
     
    2828        'title'   => __( 'Overview' ),
    2929        'content' =>
    30                 '<p>' . __( 'You can use the theme editor to edit the individual CSS and PHP files which make up your theme.' ) . '</p>' .
     30                '<p>' . __( 'You can use the theme file editor to edit the individual CSS and PHP files which make up your theme.' ) . '</p>' .
    3131                '<p>' . __( 'Begin by choosing a theme to edit from the dropdown menu and clicking the Select button. A list then appears of the theme&#8217;s template files. Clicking once on any file name causes the file to appear in the large Editor box.' ) . '</p>' .
    3232                '<p>' . __( 'For PHP files, you can use the Documentation dropdown to select from functions recognized in that file. Look Up takes you to a web page with reference material about that particular function.' ) . '</p>' .
  • trunk/src/wp-includes/general-template.php

    r52136 r52406  
    35793579 *     @type string   $type       The MIME type of the file to be edited.
    35803580 *     @type string   $file       Filename to be edited. Extension is used to sniff the type. Can be supplied as alternative to `$type` param.
    3581  *     @type WP_Theme $theme      Theme being edited when on theme editor.
    3582  *     @type string   $plugin     Plugin being edited when on plugin editor.
     3581 *     @type WP_Theme $theme      Theme being edited when on the theme file editor.
     3582 *     @type string   $plugin     Plugin being edited when on the plugin file editor.
    35833583 *     @type array    $codemirror Additional CodeMirror setting overrides.
    35843584 *     @type array    $csslint    CSSLint rule overrides.
     
    36703670 *     @type string   $type       The MIME type of the file to be edited.
    36713671 *     @type string   $file       Filename to be edited. Extension is used to sniff the type. Can be supplied as alternative to `$type` param.
    3672  *     @type WP_Theme $theme      Theme being edited when on theme editor.
    3673  *     @type string   $plugin     Plugin being edited when on plugin editor.
     3672 *     @type WP_Theme $theme      Theme being edited when on the theme file editor.
     3673 *     @type string   $plugin     Plugin being edited when on the plugin file editor.
    36743674 *     @type array    $codemirror Additional CodeMirror setting overrides.
    36753675 *     @type array    $csslint    CSSLint rule overrides.
     
    40074007     *     @type string   $type       The MIME type of the file to be edited.
    40084008     *     @type string   $file       Filename being edited.
    4009      *     @type WP_Theme $theme      Theme being edited when on theme editor.
    4010      *     @type string   $plugin     Plugin being edited when on plugin editor.
     4009     *     @type WP_Theme $theme      Theme being edited when on the theme file editor.
     4010     *     @type string   $plugin     Plugin being edited when on the plugin file editor.
    40114011     *     @type array    $codemirror Additional CodeMirror setting overrides.
    40124012     *     @type array    $csslint    CSSLint rule overrides.
Note: See TracChangeset for help on using the changeset viewer.