Commit: https://git.drupalcode.org/project/field_group/commit/1f05a00
the field_layout module sets #group for elements, after this the field group module don't set own the group.

https://git.drupalcode.org/project/drupal/blob/8.8.x/core/modules/field_...

Comments

m.lebedev created an issue. See original summary.

bmustafa’s picture

I confirm i have the same issue as well on my fresh installation of

  • Apache/2.4.39 (Win64) PHP/7.3.5
  • mysql DATABASE SYSTEM VERSION 5.7.26
  • Drupal Version 8.7.10

i am using field_layout module + display suite

in the edit-form -- the fieldgroups are not rendering
but in the display-mode the fieldgroups are showing okay.

i managed to fix as follows - on line 345 of field_group.module ::

    
        foreach ($group->children as $child) {
       
          $element[$child]['#group'] = $group_children_parent_group;
        
    }  

bmustafa’s picture

Priority: Normal » Critical
Status: Active » Needs review

just add this under line 345 of field_group.module:

      foreach ($group->children as $child) {
          $element[$child]['#group'] = $group_children_parent_group;
      }
imclean’s picture

StatusFileSize
new614 bytes

After #3086818: Assigned fieldgroup gets overwitten field groups aren't displaying at all. I don't think the check is the right one here, this should be removed at least.

imclean’s picture

Without the patch in #4 it breaks down when the groups are nested.

For example:

  1. Create a top level group of "Tabs" , direction horizontal in my case.
  2. Under the "Tabs" group, add a few groups of type "Tab", with the tab set to "Closed"
  3. Add fields to each "Tab" group
bmustafa’s picture

I would add this note as well:

this solution in #3 and #4 - works for me to render fieldgroups on both

  • parent entity form fields
  • inline entity forms fields (ief)

so far, am happy with it.

m.lebedev’s picture

StatusFileSize
new1.18 KB

Quick fix for field layout module

m.lebedev’s picture

Status: Needs review » Needs work

Also, "needs work" for others modules which changes the form.

Upd:
I looked the ivw_integration module and it seems that the parent issue should be fixed in the ivw_integration module.
Tracking all dependent modules will be difficult.
It will be easier to roll back the commit and solve problems in relevant modules.

shagel’s picture

when i reported the bug
https://www.drupal.org/project/field_group/issues/3086818
i had a solution for the ivw module too using the group_form_process_build_alter hook. But i decided to try to fix this in the field group module.
Unfortunately it seems that the fix influenced other parts of the field group module too.

function ivw_integration_field_group_form_process_build_alter (&$field_group_element, &$group, &$element) {
$entity = \Drupal::routeMatch()->getParameter('node');
if ($entity instanceof \Drupal\node\NodeInterface) {
$has_settings = FALSE;
/*
* Set group of all ivw_integration_settings elements
*/
foreach ($entity->getFieldDefinitions() as $fieldDefinition) {
if ($fieldDefinition->getType() === 'ivw_integration_settings') {
$has_settings = TRUE;
$element[$fieldDefinition->getName()]['#group'] = 'ivw_integration_settings_override';
}
}
}
}

bmustafa’s picture

Patch number 7 has broken the IEF form - i use inline table - the IEF does not open anymore - so i reverted back to patch#3

imclean’s picture

Formatted ivw_integration from #9. Inline comments should use //.

This could be something which is fixed in other modules as field_group shouldn't need to be aware of them all.

function ivw_integration_field_group_form_process_build_alter (&$field_group_element, &$group, &$element) {
  $entity = \Drupal::routeMatch()->getParameter('node');
  if ($entity instanceof \Drupal\node\NodeInterface) {
    $has_settings = FALSE;

    // Set group of all ivw_integration_settings elements
    foreach ($entity->getFieldDefinitions() as $fieldDefinition) {
      if ($fieldDefinition->getType() === 'ivw_integration_settings') {
        $has_settings = TRUE;
        $element[$fieldDefinition->getName()]['#group'] = 'ivw_integration_settings_override';
      }
    }
  }
}

I'm not sure what $has_settings is used for here.

nils.destoop’s picture

An option could be that we add a flag that can be set. If that one is set, field group stays of the original #group value. This way, users can still set a #group in the build form part.

imclean’s picture

@zuuperman, I was trying to find something unique within the element/group to check but manually setting a flag could be an easier option.

Would all modules which provide a group need to set it to be compatible with field_group?

  • nils.destoop committed a0b671a on 8.x-3.x
    Issue #3095570 by m.lebedev, imclean, nils.destoop: after update to 3.0-...
nils.destoop’s picture

Status: Needs work » Fixed

I committed the new flag. If you set #field_group_ignore to TRUE, field group will not touch the group value. This should fix all issues and provide other contribs an option to force values.

Status: Fixed » Closed (fixed)

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