Problem
On any entity form carrying a site_settings field (e.g. a group-based site's add/edit form), every setting renders twice — duplicate vertical tabs and duplicate field widgets, with duplicate DOM ids.
Cause
sites_element_info_alter() (SitesHooks::elementInfoAlter) appends the generic processGroup/preRenderGroup callbacks to every element type, guarded by a detection loop that only matches those two method names. Core vertical_tabs has its own group handling (processVerticalTabs/preRenderVerticalTabs) under different names, so the loop doesn't recognize it and bolts the generic group system on top — making it inject its panes a second time.
This is compounded by SiteSettings::buildSiteSettingsForm() nesting the per-plugin detail panes inside the vertical_tabs container instead of as siblings (the standard Drupal pattern).
Fix
- Teach the
element_info_alterdetection to recognize native vertical-tabs handling, sovertical_tabsis left alone. - Build the default-environment panes as siblings of the
vertical_tabscontainer with#parentspinned (value path unchanged), matching how core node-form vertical tabs work.
Confirmed via render: duplicate DOM ids 31 → 0, each field rendered once, availability filtering and submitted-value path preserved. A functional test asserting available settings render once is added in the sites_group integration.
The MR also drops the now-unnecessary drupal/json_field dependency: the site_settings field type only used NativeJsonItem for a value property + JSON column, which is inlined verbatim (identical json column → no data migration).
Issue fork sites-3605652
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
harlor commentedWe should make sure that environment settings are saved correctly.
If that works I'm ok merging this.
Comment #5
hydra commented