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

  1. Teach the element_info_alter detection to recognize native vertical-tabs handling, so vertical_tabs is left alone.
  2. Build the default-environment panes as siblings of the vertical_tabs container with #parents pinned (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

Command icon 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

hydra created an issue. See original summary.

harlor’s picture

We should make sure that environment settings are saved correctly.

If that works I'm ok merging this.

  • hydra committed bd74300d on 1.x
    fix: #3605652 Site settings form renders every field twice (vertical-...
hydra’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.