-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Template Switcher: Add current theme #21578
Conversation
Size Change: +1.17 kB (0%) Total Size: 841 kB
ℹ️ View Unchanged
|
3704d06
to
4950572
Compare
I wonder, does the code in #222 need to go into the Gutenberg plugin for the time being? Otherwise, wouldn't the feature be broken until the next WordPress core update? |
I think so, yeah. Probably by tapping into |
Yep, that worked: c74cf62 🎉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probable some failures on php linting. Otherwise, it looks good to me.
Thanks Riad! Ah, looks like it's actually a PHP unit test, I'll look into it. Edit: Nope, PHP lint run inside Travis' unit test job 😅 |
In #21578, I added a few fields to Core's `/themes` endpoint, for use by the Site Editor's Template Switcher (see both #21578 and #21768). I then submitted those changes as a [PR](WordPress/wordpress-develop#222) against Core. That PR underwent a number of modifications and was eventually merged; the new fields will be part of the `/themes` endpoint exposed by Core starting from the next WP release. This PR updates the fields added by Gutenberg to follow the same semantics, as well as the callsites that use that endpoint.
Description
Display the current theme name in the template selector of
edit-site
.Since the
/themes
endpoint currently only exposes thetheme_supports
field for each theme, this PR adds a number of additional fields to it, using therest_prepare_theme
hook. (I also filed a WordPress/wordpress-develop#222 against Core to extend the, err, upstream endpoint accordingly so that we can eventually drop the filter.)In addition, this PR adds a new
getCurrentTheme
selector and related reducer/resolver/action tocore-data
(including athemes
reducer for better normalization).Finally, that selector is used to render the theme name in
edit-site
's template selector.The fields I've chosen to add should be sufficient to implement the on-hover previews seen at #20469 (comment):
However, this PR doesn't implement those previews yet, since we need to implement the underlying fly-out menu component first (see #20470).
Fixes part of #20469.
How has this been tested?
Screenshots
Types of changes
New feature
Checklist: