Problem/Motivation

When a field group contains child fields, moving those child fields to the ground level (content region) does not properly update the parent-child relationship. The field appears visually on the "ground level", but programmatically still have the disabled group as its parent.

Proposed resolution

Update the drag and drop javascript.

Remaining tasks

User interface changes

API changes

Data model changes

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

grevil created an issue. See original summary.

grevil’s picture

Issue summary: View changes

anybody’s picture

Priority: Normal » Major
grevil’s picture

Title: Child fields moved from disabled groups retain parent relationship » Manage Display: Child fields moved from groups to "ground level" retain parent relationship
Issue summary: View changes
Status: Active » Needs work

Complete, utter bullshit, sry. I'll reset the MR immediately.

grevil’s picture

#3085858: Drag and drop acts weird, sometimes not resetting the parent, or even clearing the region value suggests using the patch in #3087608: Tabledrag is resetting the region value if items are nested, but this doesn't do the trick and here is why:

I think, the MAIN problem is, that Drupal core nor field_group have any logic, when the parent changes. Neither when manually setting the parent or drag and dropping. Inside "onChange, in drupal cores field_ui, "regionChange" is being called, when the region changes and the same happens inside "onDrop" (for the drag and drop behavior).

But there isn't any logic for when we manually (or via drag and drop) change the parent.

In Drupal core, this doesn't matter, changing the parent without field_group enabled and saving, simply resets the parent again and that is fine, since there is no "real" parent logic in Drupal core. Only regions. But field_group heavily relies on the parents.

This seems like a regression in core, but I couldn't find the proper issue yet. Basically, core should provide the same logic as with changeRegion, or we need to manually implement it in field_group.

grevil’s picture

Status: Needs work » Postponed
StatusFileSize
new1.83 KB

Alright, that's it! Unfortunately, this change won't do anything as long as #3539083: Field UI: Parent-child relationships not properly updated when fields are moved via drag-and-drop (Field Group) is not merged, so I'll postpone this issue. For now.

Feel free to use the attached patch in combination with the core patch from https://www.drupal.org/files/issues/2025-07-31/3539083-field-ui-parent-c..., to test the fixes!

anybody’s picture

StatusFileSize
new1.83 KB

Static patch attached until this is merged. See the important notes in #9!

grevil’s picture

Just a quick note, "Gin" provides their own tabledrag.js, meaning instead of using the patch from #3539083: Field UI: Parent-child relationships not properly updated when fields are moved via drag-and-drop (Field Group), this one is required instead: https://git.drupalcode.org/project/gin/-/work_items/3542075

Though, it doesn't work perfectly yet, when moving a group as a subgroup in other groups, the subgroup that got moved in, is suddenly disabled.

grevil’s picture

Status: Postponed » Closed (duplicate)

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.