Repository navigation
Shadow: Add a PHP helper for block support classes and styles - #84205
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. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
Updated as activity occurs, without notifying anyone named here. Add the 📦 Bundle sizeSize Change: 0 B Total Size: 8.61 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. Undo restores the post selection when another synced entity is loaded (RTC WebSocket) in
|
49710a1 to
4135ece
Compare
48b5f24 to
ee2145e
Compare
4f78f3f to
d1bd21f
Compare
2babf82 to
9258290
Compare
9258290 to
eee8034
Compare
eee8034 to
e46f67b
Compare
8da29c5 to
8a69942
Compare
|
Thanks for the reviews and testing 👍 I've pushed a few final tweaks:
PHPStan landed on trunk this week and doesn't know about the new helpers yet, since it isn't in Core until WordPress/wordpress-develop#14094. So I've added a temporary baseline entry for it. |
573170b to
376f301
Compare
Search and Icon now get their shadow from the helper, like the other blocks in this PR, with the same output as trunk. Each gets one render test. The tests now cover the helper's own cases and one migration per block. Cases that re-tested the style engine are dropped.
Matches the colour, border and background helpers, and names the helper test like theirs.
The block library calls wp_get_shadow_classes_and_styles(), which the build prefixes to gutenberg_get_shadow_classes_and_styles() for the plugin, but which PHPStan resolves from the WordPress stubs. The stubs were generated from core trunk, which lacks the function, so its calls were baselined as not found. Generate the stubs from wordpress-develop PR 14094, which backports the helper, and drop the four baselined errors. Regenerate them from trunk once the backport is committed. Co-Authored-By: Claude Opus 5.5 (medium effort) <noreply@anthropic.com> Claude-Code-Session-Id: cfcf15e8-ccc1-4d78-a7c9-51f73e8e4b92
…on until the stubs include it
a2fa893 to
1a3c0e7
Compare


Follows up on #83122.
Core backport: wordpress-develop#14094.
Related:
What?
Adds a PHP helper that turns a block's shadow into inline styles, like the JS
getShadowClassesAndStyles().The shadow block support and six blocks now use it.
Why?
Blocks that skip shadow serialization apply the shadow to an inner element, so they build the styles by hand. Six do, each with its own style engine call. A shared helper gives them one place to change.
How?
The helper only builds output. It doesn't check what a block supports. Each caller decides where the output goes.
prefixFunctions, so the plugin callsgutenberg_get_shadow_classes_and_styles()No output changes.
PHPStan's WordPress stubs are built from Core trunk, which won't have this helper until wordpress-develop#14094 lands. So this PR adds a temporary baseline entry for it. PHPStan will flag the entry for removal once the stubs move to a Core trunk with the helper.
Testing Instructions
Use of AI Tools
Implemented and tested by a Claude Code agent from a predefined task.