Repository navigation
Block Supports: Add a helper that returns every support's classes and styles - #15485
aaronrobertshaw wants to merge 15 commits into
Conversation
… is null or empty.
…nd spacing helpers.
… styles. Adds wp_get_block_supports_classes_and_styles(), which combines the background, color, border, shadow and spacing helpers in the style engine's order. An optional list limits it to the supports a block applies to one element.
Test using WordPress PlaygroundThe 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
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
ramonjd
left a comment
There was a problem hiding this comment.
Backport is accurate. I smoke tested a bunch of blocks on the frontend, checked the CSS and classnames.
Tests pass locally.
Might be worth holding off until 7.2 is stable to avoid clashes?
Thanks!
Backport of Gutenberg PR WordPress/gutenberg#86337
Trac ticket: https://core.trac.wordpress.org/ticket/66485
Adds
wp_get_block_supports_classes_and_styles(), which returns the combined classes and styles of the background, color, border, shadow and spacing helpers. An optional list limits it to the supports a block applies to one element.This PR backports:
wp_get_block_supports_classes_and_styles(), next to the other block support utilities,The Avatar and Post Navigation Link changes that call it arrive later with the Gutenberg package update.
Dependency: stacked on #14094, which adds the five helpers this one calls. Once #14094 is committed, this branch should be rebased onto trunk.
Testing instructions
Nothing renders differently, because no block calls the helper in Core yet. To check its output:
It outputs only the border and shadow, without the padding:
Without this PR the command fails with a fatal error for an undefined function.
Use of AI
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: the port from Gutenberg and the tests; I reviewed and edited them.