- Issue created by @pdureau
- 🇳🇿New Zealand quietone
Changes are made on on 11.x (our main development branch) first, and are then back ported as needed according to the Core change policies → .
SDC doesn't play well with the Form API:
This ticket is focused on the first issue, but let's keep the second one in mind.
Restriction of a chat between @pminf @mmbk & @pdureau: https://drupal.slack.com/archives/C4EDNHFGS/p1734453836627559
While processing a form the FormBuilder handles only children, returned by Element::children($element)
Render elements located in #slots are not processed, so they won't get the meta data that are necessary to process the input field, I hacked around that problem by adding the select field a top-level element of the component and added a preRenderCallback
to the SDC that is moving the select field into the slot.
This may be the same issue as the one with table render element.
Is it possible to merge #slots
and #props
into Element::children()
For example:
<code>#type: component
#component: 'provider:foo'
#slots:
slot_1: {}
slot_2: {}
#props:
prop_1: ''
prop_2: ''
Would become:
#type: component
#component: 'provider:foo'
slot_1: {}
slot_2: {}
prop_1: ''
prop_2: ''
There is no risk in merging slots & props because they already share the same namespace as Twig template variables.
But it may be not as easy and safe as adapting the form API to this special case. And fixing this at the form API level can also help us to fix the similar cases (like table
for example)
Maybe. Let's be careful.
Active
11.1 🔥
single-directory components
Changes are made on on 11.x (our main development branch) first, and are then back ported as needed according to the Core change policies → .