- Issue created by @thomas.frobieter
In the field.html.twig of a list field, the list item keys are not available to Twig, while they are available within the parent entity. The keys are often used to create CSS classes out of it.
Especially when Layout Builder is used, its kind of impossible to print the field in the ENTITY/node.html.twig, to print the field content with the key-Class right there. So the field template is a solid way around this problem.
This is what we currently have:
To get the keys inside the field.html.twig, you have to do something like this:
element['#object'].get('field_seminar_type').value
Make the keys available in the render array.
Active
11.0 🔥
Enhances developer experience.