[TwigBridge] Add block_export() support to form attribute blocks - #65873
Open
seb-jean wants to merge 1 commit into
Open
[TwigBridge] Add block_export() support to form attribute blocks#65873seb-jean wants to merge 1 commit into
block_export() support to form attribute blocks#65873seb-jean wants to merge 1 commit into
Conversation
Refactor widget_attributes, widget_container_attributes,
button_attributes, and attributes blocks so that the attributes
hash is built first, exported via block_export(), then rendered
as HTML.
This allows Twig Component form themes to retrieve the processed
attributes as a hash using block_data(), enabling the spread
syntax ({{ ...hash }}) on <twig:> components.
Existing form themes are not affected — block() still returns
the rendered HTML string as before.
See symfony#65713
Depends on twigphp/Twig#4919
seb-jean
force-pushed
the
form-attributes-function
branch
from
September 6, 2026 13:11
cc7706d to
cb66701
Compare
block_export() support to form attribute blocks
Member
|
We need some compat code or a min-version bump of course. Also the twig merged obviously. Status: needs work |
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.
Summary
widget_attributes,widget_container_attributes,button_attributes, andattributesblocks inform_div_layout.html.twigattributesblock now builds a normalized hash (attrs), exports it viablock_export(attrs), then renders HTML from that hashwidget_attributes,widget_container_attributes, andbutton_attributesblocks setattrwith proper ordering (standard attributes first, user attributes merged after) before delegating toattributesThis allows Twig Component form themes to retrieve the processed attributes as a hash using
block_data(), enabling the spread syntax ({{ ...hash }}) on<twig:>components:Existing form themes are not affected —
block('widget_attributes')still returns the rendered HTML string as before.Dependencies
This depends on twigphp/Twig#4920 which adds
block_data()andblock_export()to Twig core.Related issue: twigphp/Twig#4919