Make style book available to classic themes #8320
Open
+19
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is the PHP backport of WordPress/gutenberg#69043.
It is not fully functional without the JavaScript changes.
In this alternative for the stylebook in classic themes, all classic themes have a menu under Appearance called Design.
Design opens the preview of the homepage, and the sidebar has two menu items: Patterns and Styles.
Styles opens the Stylebook. This stylebook is not interactive: not yet. It is a preview of the color palette, blocks etc.
In other words, there is no opt-in for the stylebook, it is available by default.
The PR enables access to the stylebook by:
show_in_rest
set to true.In addition, the PR updates the path to the patterns page, following the recent change to the site editor URLs.
Trac ticket:
https://core.trac.wordpress.org/ticket/62509
Testing Instructions
Activate any classic theme.
Go to Appearance > Design > Styles.
The Stylebook should display correctly.
Add
remove_theme_support( 'stylebook' );
to the theme, for example in the themes functions.php file, in the theme setup.Check that the Appearance menu now has Patterns instead of Design.
(This is the part that needs the JavaScript changes: When you activate the Patterns link, and go back one step, you will see that the style book is still available even though the theme support has been removed.)
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.