Repository navigation
Border: Add a PHP helper for block support classes and styles - #84207
aaronrobertshaw wants to merge 8 commits into
Conversation
🤖 PR meta 🤖🎉 PropsIf 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. Updated as activity occurs, without notifying anyone named here. Add the 📦 Bundle sizeSize Change: 0 B Total Size: 9.05 MB
⚡ PerformanceShow the resultsClient side metrics exclude the server response time. front-end-block-theme
front-end-classic-theme
media-processing
media-upload
post-editor
site-editor
🏁 Flaky testsSome tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information. Regression: updating a specific option will only change its value and will not corrupt others in
|
3b87a31 to
4fb89d6
Compare
6d5fd2d to
ce7e5c6
Compare
54238c5 to
ead2d72
Compare
…style variables An empty, null, false or zero borderColor now falls back to the custom color, as in the color helper and JS. The quirk tests for side rules are dropped, and the block tests keep one exact-output test each.
b122008 to
bc6a069
Compare
Follows up on #83122.
Related:
Core backport: wordpress-develop#14094.
What?
Adds a PHP version of the JS
getBorderClassesAndStyles(), which turns border attributes into classes and inline styles.The border block support and four blocks now use it.
Why?
Four blocks skip border serialization and rebuild their border styles by hand. Their copies have drifted from the block support:
55px0now outputs0px, as the block support does.One helper keeps them all in step.
How?
The helper only builds output. It doesn't check block support.
prefixFunctions, so the plugin callsgutenberg_get_border_classes_and_styles()The only block support output change: a null, false, empty or zero
borderColornow falls back to the custom color, as in JS. So does an array, which cannot form a class name.Testing Instructions
Markup matches trunk
Unitless values
"radius":5on the Avatar's border.border-radius:5px. On trunk it has no radius.Use of AI Tools
Implemented and tested by a Claude Code agent from a predefined task.