Repository navigation
Block Bindings: Add server support for innerBlocks bindings - #79939
cbravobernal wants to merge 6 commits into
Conversation
bf6fbda to
0c782e1
Compare
|
Flaky tests detected in ab2ab5d. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/29247289172
|
f5a7683 to
97ff55e
Compare
There was a problem hiding this comment.
Pull request overview
Adds experimental PHP/server-side rendering support for metadata.bindings.innerBlocks so core blocks can have their child block tree supplied by the core/pattern-overrides bindings source during frontend rendering.
Changes:
- Introduces a server-side
render_block_data/pre_render_blockimplementation to resolve and substitute boundinnerBlocks(including wrapper preservation viainnerContentrebuilding). - Adds PHPUnit coverage for inner-block substitution behavior (fallback vs empty vs substituted, context inheritance, static wrapper preservation, recursion via nested bindings).
- Adds PHPUnit coverage to ensure
core/list-itemreconciliation behaves correctly when bothcontentandinnerBlocksbindings are present.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
lib/load.php |
Loads the new experimental innerBlocks bindings server support. |
lib/experimental/block-bindings-inner-blocks.php |
Implements innerBlocks binding gating, substitution, wrapper preservation, and top-level handling. |
phpunit/block-bindings-innerblocks-test.php |
Adds extensive unit tests for innerBlocks substitution, wrapper preservation, and context behavior. |
phpunit/block-bindings-list-item-test.php |
Adds tests ensuring list-item shim behavior doesn’t double-render or drop substituted children. |
4acacda to
639c56c
Compare
|
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. |
e92a1e4 to
0e019cf
Compare
ec4924c to
a13722d
Compare
|
Closing in favor of #85568, which renders innerBlocks bindings on the server behind the |
Pull request was closed
I think this server flow presents better what it does rather than AI gen description.
Complete server flow
Saved block markup
│
▼
WordPress parses fallback children
│
▼
Is metadata.bindings.innerBlocks eligible?
│
├── No ──► Render normal fallback children
│
▼
Is the block nested?
│
├── Yes ─► render_block_data path
│ Find child WP_Block and inherited context
│
└── No ──► pre_render_block takeover
Reproduce data/context filters
│
▼
Call the registered source
│
├── null/non-string ─► Keep fallback
├── '' ──────────────► Render empty area
└── markup string ───► Parse replacement blocks
│
▼
Rebuild innerBlocks + innerContent + innerHTML
│
▼
Render replacement children inside the original host wrapper
AI Description
What?
Adds the Gutenberg-only server half of the experimental innerBlocks binding for WP 7.2 and registers it behind a user-enabled Gutenberg experiment.
A standard, otherwise-uncontrolled InnerBlocks host may resolve its children from a registered source. The shared value contract is deliberate: a serialized block-markup string replaces fallback children;
null,undefined, and other non-string values fall back to the hosts own children;''is intentionally empty. The server does not apply a different source-value transformation than the editor.Nested resolution uses
render_block_data. The necessary top-levelpre_render_blockshim mirrors therender_block()tail because a plugin cannot extendWP_Block; that code would move into Core if the experiment is adopted.Experimental first slice and caveats
blockBindingsInnerBlockseditor setting for WP 7.2; Core remains inert and there is no Core sync in this stack.metadata.bindings.innerBlocksdescriptor.core/html, hosts with multiple or interleaved structural areas, and caller-controlled InnerBlocks areas are excluded.core/html, or multiple structural areas needs a separate HTML API design to identify and replace the right slot safely; this experiment must not infer it from arbitrary HTML or use regex.Stack: #79855 → this PR → #79940 → #79852.