- Issue created by @mherchel
This issue arrises from
✨
Create twig filters: |add_class and |set_attribute
Fixed
, where there is discussion on how the |add_class
filter should work when it runs into an array of render arrays.
From @pdureau
I am afraid it will not work because the themers don't know if the renderable they print is a single render array or a list of them.
For example, without talking about those new filters, because a list of renderable is also a renderable, it is already safer for themers to print directly the variable:
From @lauriii
Thanks for the feedback @pdureau! That seems like a valid use case, but OTOH we don't generally apply filters across child elements like what you are proposing. I'm wondering if this could be handled on the render array level by introducing a new type that allows inheriting properties to children?
Something like this:
[ '#type' => 'inherit', '#attributes' => ... [ '#type' => 'custom_button', '#label' => 'Hello', ], [ '#type' => 'custom_button', '#label' => 'Hello', ] ]
I guess there could be other ways to create similar functionality. I'm not too keen to what I'm proposed here so if someone has better ideas, I'd be open to that.
Active
10.1 ✨
Last updated