Side-quest of
π
Simplify Element::children() stable sort.
Needs work
There seems to be a problem with the #groups logic for vertical tabs.
It might be specific to the filter admin form, or it could be a more general problem.
In FilterFormatFormBase::form()
, if we omit the $form['filters']['settings'][$name]['#weight'], the vertical tabs won't show up on admin/config/content/formats/manage/full_html
.
To demonstrate, I attach a patch with failing test.
Looking further into this, using a #post_render callback for debugging, I found that by removing the #weight, the following form array elements become references, instead of regular arrays:
$form['filters']['settings']['filter_html']
$form['filters']['settings']['filter_url']
I suppose what happens now is the element being rendered twice, and the second time $elements['#printed'] is already set, so it skips.
Something like this.
The reason for the reference vs no-reference: If a #weight is set on any one child element, then Element::children()
will remove and re-insert all the children, effectively destroying all references.
However, by removing the #weight from all children, Element::children()
will silently pass through and do nothing.
Interestingly, other forms with vertical tabs work just fine without weights. One example is the visibility tabs in the BlockForm.