Section Styles: Clean up block style variation filters#62858
Conversation
|
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
✅ Checked the deleted filters against the Core patch
Could you remind me how to test this again? |
Thanks for the quick review. I've tried updating the test instructions. I'll try again here for good measure.
register_block_style(
'core/group',
array(
'name' => 'my-custom-variation',
'label' => __( 'Custom' ),
)
);{
...
"styles": {
"variations": {
"my-custom-variation": {
"color": {
"background": "black",
"text": "white"
},
}
}
}
} |
That's the bit I forgot. LGTM |
It was only a recent change to the way it all works so easily done! Appreciate the repeated reviews on this one. |
andrewserong
left a comment
There was a problem hiding this comment.
All the variations of variations are testing well for me, too! 😄
7acdcef to
37ac727
Compare
What?
Removes block style variation filters that were initially added to core for 6.6 but ultimately removed in WordPress/wordpress-develop#6873.
Why?
The functions don't exist and the filters are never ended up in core so there's nothing to remove in Gutenberg. The removal of the filters should have been removed before landing #62712.
How?
Delete lines.
Testing Instructions
register_block_style/stylesdirectory includingblockTypesstyles.variations(must be registered via either of the above two methods)register_block_styleor theme.json partial in prior stepsregister_block_style, passing only thenameandlabelin thestyle_propertiesarray. This registration will mean the theme style variation's definition is not sanitized.`register_block_style` Example
Theme.json Partial Example
{ "$schema": "https://schemas.wp.org/trunk/theme.json", "version": 3, "title": "Section A", "slug": "section-a", "blockTypes": [ "core/group" ], "styles": { "color": { "background": "slategrey", "text": "snow" }, "blocks": { "core/group": { "color": { "background": "darkslategrey", "text": "whitesmoke" } } } } }Theme Style Variation Example (`styles.variations`)
{ "styles": { "variations": { "section-a": { "color": { "background": "var(--wp--preset--color--theme-2)", "text": "var(--wp--preset--color--theme-5)" }, "blocks": { "core/group": { "color": { "background": "var(--wp--preset--color--theme-4)", "text": "var(--wp--preset--color--theme-2)" } } } } } } }Alternatively, confirm that the removed filters don't exist in core and are safe to remove since WordPress/wordpress-develop#6873 was committed.
Screenshots or screencast
No visual changes.