Block bindings : add support to list-item#78947
Merged
cbravobernal merged 6 commits intoJun 17, 2026
Merged
Conversation
cbravobernal
added a commit
to cbravobernal/gutenberg
that referenced
this pull request
Jun 6, 2026
Add server-side rendering support so a bound `core/list-item` content attribute is replaced without dropping nested List inner blocks rendered inside the same `<li>`. All logic lives in the wordpress-7.1 compat layer: a `render_block_data` filter hides the binding from Core's generic rich-text replacement, and a `render_block` filter resolves the value through the existing `gutenberg_process_block_bindings()` helper and applies it with a nested-list-aware replacement. The shipped wordpress-6.9 block-bindings code is left untouched and no new hooks are introduced. Adds PHPUnit coverage (plain text, nested/ordered/deep lists, empty value, pattern overrides, sanitization, non-list inner blocks) and an editor e2e test. Builds on WordPress#78947 (list-item block bindings support). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
cbravobernal
added a commit
to cbravobernal/gutenberg
that referenced
this pull request
Jun 7, 2026
Add server-side rendering support so a bound `core/list-item` content attribute is replaced without dropping nested List inner blocks rendered inside the same `<li>`. All logic lives in the wordpress-7.1 compat layer: a `render_block_data` filter hides the binding from Core's generic rich-text replacement, and a `render_block` filter resolves the value through the existing `gutenberg_process_block_bindings()` helper and applies it with a nested-list-aware replacement. The shipped wordpress-6.9 block-bindings code is left untouched and no new hooks are introduced. Adds PHPUnit coverage (plain text, nested/ordered/deep lists, empty value, pattern overrides, sanitization, non-list inner blocks) and an editor e2e test. Builds on WordPress#78947 (list-item block bindings support). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
cbravobernal
added a commit
to cbravobernal/gutenberg
that referenced
this pull request
Jun 9, 2026
Add server-side rendering support so a bound `core/list-item` content attribute is replaced without dropping nested List inner blocks rendered inside the same `<li>`. All logic lives in the wordpress-7.1 compat layer: a `render_block_data` filter hides the binding from Core's generic rich-text replacement, and a `render_block` filter resolves the value through the existing `gutenberg_process_block_bindings()` helper and applies it with a nested-list-aware replacement. The shipped wordpress-6.9 block-bindings code is left untouched and no new hooks are introduced. Adds PHPUnit coverage (plain text, nested/ordered/deep lists, empty value, pattern overrides, sanitization, non-list inner blocks) and an editor e2e test. Builds on WordPress#78947 (list-item block bindings support). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
cbravobernal
added a commit
to cbravobernal/gutenberg
that referenced
this pull request
Jun 17, 2026
The non-nested List Item binding tests (plain text, sanitization, inline image) exercise only the enablement filter and now live in WordPress#78947. Keep here the cases that depend on the inner-block preservation workaround: nested lists, ordered and deeply nested lists, empty values, non-list inner blocks and pattern overrides.
|
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 Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @[email protected]. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. 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. |
This reverts commit bedda6a.
Add phpunit coverage for binding a List Item's content with non-nested values (plain text, sanitized markup, inline image replacement). These exercise the enablement filter alone and need no inner-block preservation.
596e9c6 to
c72b88e
Compare
cbravobernal
approved these changes
Jun 17, 2026
This was referenced Jun 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Adds
core/list-itemto the block attributes supported by Block Bindings, so a List Item'scontentrich text can be bound to a source.This is part of the List Item Block Bindings work, split into two PRs for review hygiene:
block_bindings_supported_attributesfilter + basic (non-nested) tests. Lands first.Why?
The List Item block had no Block Bindings support, so its content couldn't be driven by a source (custom sources, pattern overrides, etc.). Enabling
contentis a small, low-risk change. Preserving a nested List inside the same<li>when the content is bound is a separate render-side concern, handled in #78991, so this PR stays a clean enablement.How?
Registers
contentas a supported binding attribute forcore/list-itemthrough theblock_bindings_supported_attributesfilter (compat shim inlib/compat/wordpress-7.1/block-bindings.php).Adds phpunit coverage for the cases that need only the filter — no render changes: plain-text values, post-KSES sanitization, and inline-image/markup replacement. Nested-list preservation tests live with the fix in #78991.
Related
backport-changelog/7.1/12204.md)Testing Instructions
contentattribute to a source (e.g. a custom Block Bindings source, or a pattern override).Or run the PHP unit tests:
Testing Instructions for Keyboard
N/A — no UI changes.
Use of AI Tools
The PR description and the basic phpunit tests were drafted with AI assistance (Claude Code) and reviewed by a maintainer. The filter implementation is the original contribution by @Sauliusv.