-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Backport: Duotone changes #4619
Conversation
Some of the duotone code depends on WordPress/gutenberg#46496 getting backported first. |
@MaggieCabrera is there a Trac ticket for these changes? If not, we'll need to create one and add it in the PR description. |
No, I was planning on doing that today |
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.
Thanks for the PR!
I left some comments concerning this changeset :)
Backport PR that includes #4619 over here: It also includes changes from WordPress/gutenberg#49427 |
Reverting changes to Tests_Theme_wpThemeJson that will need to be reinstated after WordPress#4619 merges
Reverting changes to Tests_Theme_wpThemeJson that will need to be reinstated after WordPress#4619 merges
Would this PR also need backporting for duotone to work? cc @ajlende |
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.
I've added a few notes relating to the docblocks and locations.
I've used 🔢 to indicate that the item applies in multiple locations.
'register_attribute' => array( 'WP_Duotone', 'register_duotone_support' ), | ||
) | ||
); | ||
|
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.
This block ought to be in the default-filters file.
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.
All of the other block supports (layout and position) have their hooks co-located with the support registration in block-supports. Should those be moved too? Or is it okay having these here?
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.
@ajlende let's leave it as is for now (including in this PR). They probably all should be in default-filters but probably a discussion for another time.
src/wp-includes/class-wp-duotone.php
Outdated
* Migrate the old experimental duotone support flag to its stabilized location | ||
* under `supports.filter.duotone` and sets. |
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.
Again this needs to be split in to a summary and longer description/
When the developer docs are generated the first line is a short summary displayed below the title, followed by a longer description that goes in to detail. See https://developer.wordpress.org/reference/classes/wp_query/get_posts/ fpr example.
🔢 This chnage is needed in numerous places so I'll get you to reeveluate them rather than continue adding noise to the PR
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.
@ajlende can you help with this one?
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.
Updated in 0b06740.
Reverting changes to Tests_Theme_wpThemeJson that will need to be reinstated after WordPress#4619 merges
Reverting changes to Tests_Theme_wpThemeJson that will need to be reinstated after WordPress#4619 merges
f137c68
to
2631e83
Compare
9f04e3c
to
15c4d35
Compare
@peterwilsoncc All of the public methods are to be used exclusively with the hooks that we have defined. The other block supports have |
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.
I've tested this manually on top of:
Functionality-wise things are working well for me.
I think it'll just need a final comb from a core committer?
* @param string $slug The slug of the duotone preset. | ||
* @return string The CSS variable. | ||
*/ | ||
private static function get_css_var( $slug ) { |
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.
Do all these new methods require
@since 6.3.0
?
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.
Fixed in 817b916
@@ -143,8 +143,8 @@ class WP_Theme_JSON { | |||
'path' => array( 'color', 'duotone' ), | |||
'prevent_override' => array( 'color', 'defaultDuotone' ), | |||
'use_default_names' => false, | |||
'value_func' => 'wp_get_duotone_filter_property', | |||
'css_vars' => '--wp--preset--duotone--$slug', | |||
'value_func' => null, // CSS Custom Properties for duotone are handled by block supports in class-wp-duotone.php. |
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.
Suggested annotation for docblock
* @since 6.3.0 Replaced value_func for duoone with
null. Custom properties are handled by class-wp-duotone.php.
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.
Fixed in 3265f93
Hmm some of the failing tests are real though. I'm seeing 🤷 I guess we can rerun and debug when and if #4655 is committed and this PR rebased (?) |
Reverting changes to Tests_Theme_wpThemeJson that will need to be reinstated after WordPress#4619 merges
0b06740
to
386fd78
Compare
I just rebased this after #4655 got merged |
This may be something you're already checking into, but in case it helps -- it looks like a few of the test failures may be PHPUnit tests that need to be updated: |
b7ffac2
to
e2cf339
Compare
Alright, I think the remaining failing tests are unrelated to these changes, and all the feedback has been addressed. I've also tested it now that it's been rebased with the selectors API changes. So this should be ready to go except for confirming one thing:
I added |
@ajlende Items with Sorry, I'm unclear of the context for this #4619 (comment), would you be able to clarify? |
Co-authored-by: Peter Wilson <[email protected]>
Co-authored-by: Peter Wilson <[email protected]>
Co-authored-by: Peter Wilson <[email protected]>
Co-authored-by: Peter Wilson <[email protected]>
Co-authored-by: Peter Wilson <[email protected]>
Co-authored-by: Peter Wilson <[email protected]>
Co-authored-by: Peter Wilson <[email protected]>
c545054
to
2541786
Compare
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.
LGTM! Duotone filters working well in editor and front end.
This PR backports the changes made to the duotone related PHP files. I grouped them together instead of having one PR for each change because they would all depend on each other, which made more sense. This PR depends on the stabilized selectors API to be backported for the changes to work.
Trac ticket: https://core.trac.wordpress.org/ticket/58555
Backports:
class-wp-duotone-gutenberg.php
because the rest seemed dependent on other unrelated changesclass-wp-duotone-gutenberg.php
because the rest seemed dependent on other unrelated changesThis 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.