I am defining a new render element which one of the property is an array:
'#property' => [
'foo' => 'bar,
'some' => 'value',
]
I am struggling to provide a webform element configuration for this kind of property.
My idea was to add form elements to 'foo' and 'some' separately, but these get added as '#foo' and '#some' properties under the element.
If I don't define 'foo' and 'some' as default properties, the element doesn't appear at all.
I guess I could use some cryptic property like property_foo and then convert it in the prepare, but I wonder if there's a better way of doing that hacking what webform is already doing behind the scenes by assuming a one to one config to property.
Or maybe I am missing something ,quite a bit of code to debug/digest.
Comments
Comment #2
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedI use double underscores for subelement properties #{subelement}__{property}.
The Webform element UI will does properties that are array but you have to define a form element that accepts an array as the #default_value. For example, you could use the 'webform_codemirror' element with #mode: yaml which allows you to edit the array.
Comment #3
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commented