diff --git a/src/js/_enqueues/admin/common.js b/src/js/_enqueues/admin/common.js index 504c29e789..f105133d1c 100644 --- a/src/js/_enqueues/admin/common.js +++ b/src/js/_enqueues/admin/common.js @@ -1309,7 +1309,7 @@ $( function() { }); /** - * Handles tab keypresses in theme and plugin editor textareas. + * Handles tab keypresses in theme and plugin file editor textareas. * * @param {Event} e The event object. * diff --git a/src/wp-admin/css/common.css b/src/wp-admin/css/common.css index f75d9b55e1..4ae290302e 100644 --- a/src/wp-admin/css/common.css +++ b/src/wp-admin/css/common.css @@ -3145,7 +3145,7 @@ img { width: 300px; } -/* Theme/Plugin Editor */ +/* Theme/Plugin file editor */ .alignleft h2 { margin: 0; } @@ -3198,7 +3198,7 @@ img { } /* - * Styles for Theme and Plugin editors. + * Styles for Theme and Plugin file editors. */ /* Hide collapsed items. */ diff --git a/src/wp-admin/includes/deprecated.php b/src/wp-admin/includes/deprecated.php index fff0f78071..de541253bb 100644 --- a/src/wp-admin/includes/deprecated.php +++ b/src/wp-admin/includes/deprecated.php @@ -203,7 +203,7 @@ function codepress_get_lang( $filename ) { } /** - * Adds JavaScript required to make CodePress work on the theme/plugin editors. + * Adds JavaScript required to make CodePress work on the theme/plugin file editors. * * @since 2.8.0 * @deprecated 3.0.0 diff --git a/src/wp-admin/includes/file.php b/src/wp-admin/includes/file.php index 12206b78b5..b26596250e 100644 --- a/src/wp-admin/includes/file.php +++ b/src/wp-admin/includes/file.php @@ -223,7 +223,7 @@ function wp_get_plugin_file_editable_extensions( $plugin ) { ); /** - * Filters the list of file types allowed for editing in the plugin editor. + * Filters the list of file types allowed for editing in the plugin file editor. * * @since 2.8.0 * @since 4.9.0 Added the `$plugin` parameter. @@ -282,7 +282,7 @@ function wp_get_theme_file_editable_extensions( $theme ) { ); /** - * Filters the list of file types allowed for editing in the theme editor. + * Filters the list of file types allowed for editing in the theme file editor. * * @since 4.4.0 * diff --git a/src/wp-admin/includes/misc.php b/src/wp-admin/includes/misc.php index 70f6edde2b..6143b861fb 100644 --- a/src/wp-admin/includes/misc.php +++ b/src/wp-admin/includes/misc.php @@ -309,7 +309,7 @@ function iis7_save_url_rewrite_rules() { } /** - * Update the "recently-edited" file for the plugin or theme editor. + * Update the "recently-edited" file for the plugin or theme file editor. * * @since 1.5.0 * @@ -332,7 +332,7 @@ function update_recently_edited( $file ) { } /** - * Makes a tree structure for the theme editor's file list. + * Makes a tree structure for the theme file editor's file list. * * @since 4.9.0 * @access private @@ -354,7 +354,7 @@ function wp_make_theme_file_tree( $allowed_files ) { } /** - * Outputs the formatted file list for the theme editor. + * Outputs the formatted file list for the theme file editor. * * @since 4.9.0 * @access private @@ -425,7 +425,7 @@ function wp_print_theme_file_tree( $tree, $level = 2, $size = 1, $index = 1 ) { } /** - * Makes a tree structure for the plugin editor's file list. + * Makes a tree structure for the plugin file editor's file list. * * @since 4.9.0 * @access private @@ -447,7 +447,7 @@ function wp_make_plugin_file_tree( $plugin_editable_files ) { } /** - * Outputs the formatted file list for the plugin editor. + * Outputs the formatted file list for the plugin file editor. * * @since 4.9.0 * @access private diff --git a/src/wp-admin/includes/theme.php b/src/wp-admin/includes/theme.php index 8e98854afc..1e8a3fc2c6 100644 --- a/src/wp-admin/includes/theme.php +++ b/src/wp-admin/includes/theme.php @@ -146,7 +146,7 @@ function get_page_templates( $post = null, $post_type = 'page' ) { } /** - * Tidies a filename for url display by the theme editor. + * Tidies a filename for url display by the theme file editor. * * @since 2.9.0 * @access private diff --git a/src/wp-admin/menu.php b/src/wp-admin/menu.php index 928a65db3f..97d5f57984 100644 --- a/src/wp-admin/menu.php +++ b/src/wp-admin/menu.php @@ -241,28 +241,50 @@ if ( current_theme_supports( 'custom-background' ) && current_user_can( 'customi unset( $appearance_cap ); -// Add 'Theme Editor' to the bottom of the Appearance menu. +// Add 'Theme File Editor' to the bottom of the Appearance (non-block themes) or Tools (block themes) menu. if ( ! is_multisite() ) { // Must use API on the admin_menu hook, direct modification is only possible on/before the _admin_menu hook. add_action( 'admin_menu', '_add_themes_utility_last', 101 ); } /** - * Adds the 'Theme Editor' link to the bottom of the Appearance or Tools menu. + * Adds the 'Theme File Editor' menu item to the bottom of the Appearance (non-block themes) + * or Tools (block themes) menu. * * @access private * @since 3.0.0 - * @since 5.9.0 'Theme Editor' link has moved to the Tools menu when a block theme is active. + * @since 5.9.0 Renamed 'Theme Editor' to 'Theme File Editor'. + * Relocates to Tools for block themes. */ function _add_themes_utility_last() { add_submenu_page( wp_is_block_theme() ? 'tools.php' : 'themes.php', - __( 'Theme Editor' ), - __( 'Theme Editor' ), + __( 'Theme File Editor' ), + __( 'Theme File Editor' ), 'edit_themes', 'theme-editor.php' ); } +/** + * Adds the 'Plugin File Editor' menu item after the 'Themes File Editor' in Tools + * for block themes. + * + * @access private + * @since 5.9.0 + */ +function _add_plugin_file_editor_to_tools() { + if ( ! wp_is_block_theme() ) { + return; + } + add_submenu_page( + 'tools.php', + __( 'Plugin File Editor' ), + __( 'Plugin File Editor' ), + 'edit_plugins', + 'plugin-editor.php' + ); +} + $count = ''; if ( ! is_multisite() && current_user_can( 'update_plugins' ) ) { if ( ! isset( $update_data ) ) { @@ -283,7 +305,12 @@ $submenu['plugins.php'][5] = array( __( 'Installed Plugins' ), 'activate_plugins if ( ! is_multisite() ) { /* translators: Add new plugin. */ $submenu['plugins.php'][10] = array( _x( 'Add New', 'plugin' ), 'install_plugins', 'plugin-install.php' ); - $submenu['plugins.php'][15] = array( __( 'Plugin Editor' ), 'edit_plugins', 'plugin-editor.php' ); + if ( wp_is_block_theme() ) { + // Place the menu item below the Theme File Editor menu item. + add_action( 'admin_menu', '_add_plugin_file_editor_to_tools', 101 ); + } else { + $submenu['plugins.php'][15] = array( __( 'Plugin File Editor' ), 'edit_plugins', 'plugin-editor.php' ); + } } unset( $update_data ); diff --git a/src/wp-admin/network/menu.php b/src/wp-admin/network/menu.php index 28509b1769..99cfb20e25 100644 --- a/src/wp-admin/network/menu.php +++ b/src/wp-admin/network/menu.php @@ -79,7 +79,7 @@ if ( current_user_can( 'update_themes' ) && $update_data['counts']['themes'] ) { } $submenu['themes.php'][5] = array( __( 'Installed Themes' ), 'manage_network_themes', 'themes.php' ); $submenu['themes.php'][10] = array( _x( 'Add New', 'theme' ), 'install_themes', 'theme-install.php' ); -$submenu['themes.php'][15] = array( __( 'Theme Editor' ), 'edit_themes', 'theme-editor.php' ); +$submenu['themes.php'][15] = array( __( 'Theme File Editor' ), 'edit_themes', 'theme-editor.php' ); if ( current_user_can( 'update_plugins' ) && $update_data['counts']['plugins'] ) { $menu[20] = array( @@ -104,7 +104,7 @@ if ( current_user_can( 'update_plugins' ) && $update_data['counts']['plugins'] ) } $submenu['plugins.php'][5] = array( __( 'Installed Plugins' ), 'manage_network_plugins', 'plugins.php' ); $submenu['plugins.php'][10] = array( _x( 'Add New', 'plugin' ), 'install_plugins', 'plugin-install.php' ); -$submenu['plugins.php'][15] = array( __( 'Plugin Editor' ), 'edit_plugins', 'plugin-editor.php' ); +$submenu['plugins.php'][15] = array( __( 'Plugin File Editor' ), 'edit_plugins', 'plugin-editor.php' ); $menu[25] = array( __( 'Settings' ), 'manage_network_options', 'settings.php', '', 'menu-top menu-icon-settings', 'menu-settings', 'dashicons-admin-settings' ); if ( defined( 'MULTISITE' ) && defined( 'WP_ALLOW_MULTISITE' ) && WP_ALLOW_MULTISITE ) { diff --git a/src/wp-admin/network/plugin-editor.php b/src/wp-admin/network/plugin-editor.php index e807caee4a..32cb1e7119 100644 --- a/src/wp-admin/network/plugin-editor.php +++ b/src/wp-admin/network/plugin-editor.php @@ -1,6 +1,6 @@ add_help_tab( 'id' => 'overview', 'title' => __( 'Overview' ), 'content' => - '
' . __( 'You can use the plugin editor to make changes to any of your plugins’ individual PHP files. Be aware that if you make changes, plugins updates will overwrite your customizations.' ) . '
' . + '' . __( 'You can use the plugin file editor to make changes to any of your plugins’ individual PHP files. Be aware that if you make changes, plugins updates will overwrite your customizations.' ) . '
' . '' . __( '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’t forget to save your changes (Update File) when you’re finished.' ) . '
' . '' . __( '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.' ) . '
' . '' . __( 'When using a keyboard to navigate:' ) . '
' . diff --git a/src/wp-admin/theme-editor.php b/src/wp-admin/theme-editor.php index e8affbfbd2..090689d9b0 100644 --- a/src/wp-admin/theme-editor.php +++ b/src/wp-admin/theme-editor.php @@ -1,6 +1,6 @@ add_help_tab( 'id' => 'overview', 'title' => __( 'Overview' ), 'content' => - '' . __( 'You can use the theme editor to edit the individual CSS and PHP files which make up your theme.' ) . '
' . + '' . __( 'You can use the theme file editor to edit the individual CSS and PHP files which make up your theme.' ) . '
' . '' . __( 'Begin by choosing a theme to edit from the dropdown menu and clicking the Select button. A list then appears of the theme’s template files. Clicking once on any file name causes the file to appear in the large Editor box.' ) . '
' . '' . __( '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.' ) . '
' . '' . __( 'When using a keyboard to navigate:' ) . '
' . diff --git a/src/wp-includes/general-template.php b/src/wp-includes/general-template.php index 1b743eddba..92496ce92b 100644 --- a/src/wp-includes/general-template.php +++ b/src/wp-includes/general-template.php @@ -3578,8 +3578,8 @@ function wp_enqueue_editor() { * * @type string $type The MIME type of the file to be edited. * @type string $file Filename to be edited. Extension is used to sniff the type. Can be supplied as alternative to `$type` param. - * @type WP_Theme $theme Theme being edited when on theme editor. - * @type string $plugin Plugin being edited when on plugin editor. + * @type WP_Theme $theme Theme being edited when on the theme file editor. + * @type string $plugin Plugin being edited when on the plugin file editor. * @type array $codemirror Additional CodeMirror setting overrides. * @type array $csslint CSSLint rule overrides. * @type array $jshint JSHint rule overrides. @@ -3669,8 +3669,8 @@ function wp_enqueue_code_editor( $args ) { * * @type string $type The MIME type of the file to be edited. * @type string $file Filename to be edited. Extension is used to sniff the type. Can be supplied as alternative to `$type` param. - * @type WP_Theme $theme Theme being edited when on theme editor. - * @type string $plugin Plugin being edited when on plugin editor. + * @type WP_Theme $theme Theme being edited when on the theme file editor. + * @type string $plugin Plugin being edited when on the plugin file editor. * @type array $codemirror Additional CodeMirror setting overrides. * @type array $csslint CSSLint rule overrides. * @type array $jshint JSHint rule overrides. @@ -4006,8 +4006,8 @@ function wp_get_code_editor_settings( $args ) { * * @type string $type The MIME type of the file to be edited. * @type string $file Filename being edited. - * @type WP_Theme $theme Theme being edited when on theme editor. - * @type string $plugin Plugin being edited when on plugin editor. + * @type WP_Theme $theme Theme being edited when on the theme file editor. + * @type string $plugin Plugin being edited when on the plugin file editor. * @type array $codemirror Additional CodeMirror setting overrides. * @type array $csslint CSSLint rule overrides. * @type array $jshint JSHint rule overrides.