Hi,

I checked the issue Field Group not working on node edit inside paragraph and this is supposed to be fixed. But I'm still experiencing the problem described in this issue. I installed the lastest DEV version and I'm on D8.2.5...

I also tried patch that implements hook_entity_form_build_alter, but it doesn't change a thing...

Comments

robin.ingelbrecht created an issue. See original summary.

dpacassi’s picture

You can go back to field group RC6, it was a paragraphs feature actually.
You can either switch paragraphs to the dev version OR just apply this patch:
https://www.drupal.org/node/2675136

(Taken from https://www.drupal.org/node/2675136 )

I recommend you to to use the patch instead of switching to dev.

damienmckenna’s picture

FYI I had this problem too, but it turned out to be because the site was using a custom Paragraph field widget that needed the following lines added:

diff --git a/docroot/modules/custom/custom_module/src/Plugin/Field/FieldWidget/ProductLineParagraphs.php b/docroot/modules/custom/custom_module/src/Plugin/Field/FieldWidget/ProductLineParagraphs.php
index 3baaf5da..bf1ff2e4 100644
--- a/docroot/modules/custom/custom_module/src/Plugin/Field/FieldWidget/ProductLineParagraphs.php
+++ b/docroot/modules/custom/custom_module/src/Plugin/Field/FieldWidget/ProductLineParagraphs.php
@@ -235,6 +235,22 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen
 
       $display = EntityFormDisplay::collectRenderDisplay($paragraphs_entity, $this->getSetting('form_display_mode'));
 
+      // @todo Remove as part of https://www.drupal.org/node/2640056
+      // From InlineParagraphsWidget, custom integration with Field Group.
+      if (\Drupal::moduleHandler()->moduleExists('field_group')) {
+        $context = [
+          'entity_type' => $paragraphs_entity->getEntityTypeId(),
+          'bundle' => $paragraphs_entity->bundle(),
+          'entity' => $paragraphs_entity,
+          'context' => 'form',
+          'display_context' => 'form',
+          'mode' => $display->getMode(),
+        ];
+
+        field_group_attach_groups($element['subform'], $context);
+        $element['subform']['#pre_render'][] = 'field_group_form_pre_render';
+      }
+
       if ($item_mode == 'edit') {
         $display->buildForm($paragraphs_entity, $element['subform'], $form_state);
         foreach (Element::children($element['subform']) as $field) {
finne’s picture

I found the same problem when inserting field groups into profile forms. Profile forms can be inserted into user_register, and the field groups will be lost there.
Not sure if this should be fixed in core, field_group, or profile.

Editing profile.module line 237 and inserting

      if (\Drupal::moduleHandler()->moduleExists('field_group')) {
        $context = [
          'entity_type' => $profile->getEntityTypeId(),
          'bundle' => $profile->bundle(),
          'entity' => $profile,
          'context' => 'form',
          'display_context' => 'form',
          'mode' => 'default',
        ];

        field_group_attach_groups($form['entity_' . $profile_type->id()], $context);
        $form['entity_' . $profile_type->id()]['#pre_render'][] = 'field_group_form_pre_render';
      }

Does seem to fix it. But testing for field_group in profile and in paragraphs seems wrong.

See also https://www.drupal.org/node/2871480

nils.destoop’s picture

Status: Active » Closed (works as designed)

Testing for field_group is idd not nice. But as long as core does not provide #2640056: Contrib modules can't alter the building of entity form displays, it is the only option, unless the module itself provides a hook (for example inline entity form => field_group_inline_entity_form_entity_form_alter) . But if there is no hook, Fieldgroup has no clue that a second entity form is being loaded.

I'm closing this issue, as paragraphs implemented the code. If profile wants to support fieldgroup, they will also need to implement it, or provide a hook like inline entity form does.