FilterFormatEditForm vertical tabs not working without #weight.

Created on 6 July 2015, over 9 years ago
Updated 29 January 2024, 11 months ago

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.

πŸ› Bug report
Status

Closed: outdated

Version

11.0 πŸ”₯

Component
RenderΒ  β†’

Last updated about 8 hours ago

Created by

πŸ‡©πŸ‡ͺGermany donquixote

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024