Description
When using "expanded" => true
on a choice
field that contains groups, the default form theme simply renders all radio buttons/checkboxes sequentially, without headings or any other indication of the group structure (at least under Twig).
From what I can tell, this issue stems from the fact that the choices in an expanded choice field are written directly from the FormView
's choices
variable, which is structured into groups. By contrast, expanded choice fields are represented using a series of checkbox/radio button fields, which are treated as children of the choice field - the problem being that the children are not arranged in any hierarchical structure.
The FormView
for an expanded choice field does still have a choices
variable like that of a collapsed choice field, but currently there is no effective way to match up the ChoiceView
object with the corresponding child FormView
in the template, so rendering the fields from the choices
variable as with a collapsed choice field is not a viable option.