Editor: Support Stylebook in the Site Editor for classic themes.

This modifies the submenu for the Site Editor which previously linked directly to the Patterns page after [58278] to support accessing the Stylebook in classic themes via a new "Design" link. Currently, any classic themes that have either added support for `editor-styles` or have a theme.json file will automatically see this new link in the admin menu.

Props isabel_brison, poena, wildworks, mamaduka, karmatosed, joemcgill.
Fixes .


git-svn-id: https://develop.svn.wordpress.org/trunk@59905 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Joe McGill 2025-03-03 17:20:36 +00:00
parent b5e0c16c04
commit 4ed2a8b128

@ -211,7 +211,13 @@ if ( ! is_multisite() && current_user_can( 'update_themes' ) ) {
if ( wp_is_block_theme() ) {
$submenu['themes.php'][6] = array( _x( 'Editor', 'site editor menu item' ), 'edit_theme_options', 'site-editor.php' );
} else {
$submenu['themes.php'][6] = array( _x( 'Patterns', 'patterns menu item' ), 'edit_theme_options', 'site-editor.php?path=/patterns' );
$supports_stylebook = ( current_theme_supports( 'editor-styles' ) || wp_theme_has_theme_json() );
if ( $supports_stylebook ) {
$submenu['themes.php'][6] = array( _x( 'Design', 'design menu item' ), 'edit_theme_options', 'site-editor.php' );
} else {
$submenu['themes.php'][6] = array( _x( 'Patterns', 'patterns menu item' ), 'edit_theme_options', 'site-editor.php?p=/pattern' );
}
}
$customize_url = add_query_arg( 'return', urlencode( remove_query_arg( wp_removable_query_args(), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ), 'customize.php' );