Repository navigation
Block Supports: Add PHP helpers for block support classes and styles - #14094
aaronrobertshaw wants to merge 12 commits into
Conversation
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. |
a4d85e7 to
fee7818
Compare
|
I've been held up on some other priorities so this one will now be aimed for WP 7.3 |
fee7818 to
1d36d13
Compare
f8e168a to
3ebd5d1
Compare
… is null or empty.
…nd spacing helpers.
3ebd5d1 to
4020b55
Compare
|
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:
|
Backport of Gutenberg PRs
Trac ticket: https://core.trac.wordpress.org/ticket/66269
Adds PHP helpers that turn block attributes into a block support's classes and styles, like the JS
get*ClassesAndStyles()functions, and moves the block supports onto them.This PR backports:
wp_get_border_classes_and_styles(),wp_get_shadow_classes_and_styles(),wp_get_spacing_classes_and_styles(),wp_get_color_classes_and_styles()andwp_get_background_classes_and_styles(),wp_apply_border_support(),wp_apply_shadow_support(),wp_apply_spacing_support(),wp_apply_colors_support()andwp_render_background_support()built on them,The block changes that call these helpers (Avatar, Post Featured Image, Icon, Post Navigation Link, Navigation Submenu, Comment Author Avatar, Calendar and Button) arrive later with the Gutenberg package update.
Testing instructions
The block support output should be identical to trunk. The one exception: a null, false, empty or zero preset color now falls back to the custom color, as in JS. To compare, register a dynamic test block and render it on trunk and on this branch:
Both branches output:
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.