Skip to content

Commit

Permalink
Move styles submenu item into compat folder
Browse files Browse the repository at this point in the history
  • Loading branch information
tellthemachines committed Dec 6, 2024
1 parent 40ba8e6 commit 21b7928
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 30 deletions.
24 changes: 24 additions & 0 deletions lib/compat/wordpress-6.8/site-editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,27 @@ function gutenberg_styles_wp_die_handler( $default_handler ) {
return $default_handler;
}
add_filter( 'wp_die_handler', 'gutenberg_styles_wp_die_handler' );

/**
* Add a Styles submenu under the Appearance menu
* for Classic themes.
*
* @global array $submenu
*/
function gutenberg_add_styles_submenu_item() {
if ( ! wp_is_block_theme() ) {
global $submenu;

$styles_menu_item = array(
__( 'Design', 'gutenberg' ),
'edit_theme_options',
'site-editor.php',
);
// If $submenu exists, insert the Styles submenu item at position 2.
if ( $submenu && isset( $submenu['themes.php'] ) ) {
// This might not work as expected if the submenu has already been modified.
array_splice( $submenu['themes.php'], 1, 1, array( $styles_menu_item ) );
}
}
}
add_action( 'admin_init', 'gutenberg_add_styles_submenu_item' );
30 changes: 0 additions & 30 deletions lib/experimental/stylebook/classic-screen.php

This file was deleted.

0 comments on commit 21b7928

Please sign in to comment.