Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make style book available to classic themes #8320

Open
wants to merge 4 commits into
base: trunk
Choose a base branch
from

Conversation

carolinan
Copy link
Contributor

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:

  • Registering a new theme support called stylebook. To enable checking for the new theme support in the Site Editor, I needed to make it available in the themes REST API endpoint, which is why I am using https://developer.wordpress.org/reference/functions/register_theme_feature/ with show_in_rest set to true.
  • Enabling the theme support by default
  • Updating the menu item under Appearance from Patterns to Design, if the theme support is enabled.

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.

Make style book available to classic themes by registering a new theme support called "stylebook".

The stylebook is enabled by default.
Classic themes can opt-out by removing the theme support.

When the stylebook theme support is enabled, the "Patterns" menu item under Appearance changes to "Design". When the Design link is activated, the Site Editor shows a preview of the homepage and two menu items: Styles and Patterns.
Copy link

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props poena.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copy link

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • The Plugin and Theme Directories cannot be accessed within Playground.
  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant