When adding field group in display bundle config it duplicates the fields.

field group duplicates

Comments

Flodevelop created an issue. See original summary.

danny englander’s picture

I can confirm the same issue in Drupal 8.

eme’s picture

Issue summary: View changes
jmcoder2’s picture

Issue seems for 8, I'm getting it in 7 as well.
I haven't tried field groups in 7 yet though I have read the docs and know the basics of how it's changed - how you only add the names of the fields to the group array instead of putting the field definition arrays inside it, as is the case with fieldsets, and what I remember doing in previous versions of Drupal.

Here, it does appear as if the appropriate FormAPI elements are present, with the fields I moved into the fieldgroup named in a [#group] array. So it appears that trying to insert the code with hook_form_alter() isn't likely to work either.

I haven't yet tried moving the elements into a fieldset with a module. I'll probably try that soon and report back here so people know if that's an option.

Reporting back: Just found a workaround: switching the type of fieldgroup to fieldset yields a fieldset which can either be collapsible or collapsed - and note, this is with the fieldgroup module, and not by fiddling with hook_form_alter() - just hit the little gear and pick fieldset.

amuhlou’s picture

Workaround in #4 does not work in Drupal 8.4.2, with Field Group version 8.x-3.0-beta1. The duplicate field is just placed below the fieldset.

_NuMaN’s picture

I have same issue, is there any solution ?

anybody’s picture

p4trizio’s picture

I dig it a lot and... the best solution I found until this moment is to patch field_group_entity_view_alter
Looks like that hook_entity_view_alter is called multiple time

EDIT: wrong patch sorry

p4trizio’s picture

StatusFileSize
new518 bytes
steinmb’s picture

Version: 8.x-1.0-rc4 » 8.x-3.x-dev
Status: Active » Needs review

Issue getting a little old. Core and this module have moved on. Perhaps we not make sure patches apply against latest dev version?

p4trizio’s picture

Title: Does not work with ECK » Duplicated fields with field_group on referenced entities

Hi Stein, the provided patch solves the problem for me with
- drupal 8.5.4
- field_group 8.x-3.x-dev
- eck 8.x-1.0-alpha3

Changing the title of the issue to "Duplicated fields with field_group on referenced entities" since the problem is visible if you set up a field group on an ECK entity that is referenced by a node: on the node view you see duplicated fields right after the field group.

sim_1’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community
StatusFileSize
new86.37 KB

I added a screenshot to the description to help illustrate the bug.

The provided patch worked for me as well when I tested with:
- Drupal 8.5.5,
- field_group 8.x-3.0-beta1
- ECK 8.x-1.0-alpha3

Are there other steps needed? For now I'm marking it as RTBC.

sime’s picture

Title: Duplicated fields with field_group on referenced entities » Duplicated fields with field_group on referenced ECK entities

Changed the title to indicate that this is specific to integration with ECK module.

nils.destoop’s picture

Status: Reviewed & tested by the community » Needs work

The patch is not ok, as it will cause to nest 2 times for all other entity types. The main issue is probably that field_group_theme_registry_alter needs to be updated for eck support. There is code for eck, but it probably needs an update.

nils.destoop’s picture

The rendering is working completely, but there is an issue with the default properties of eck (like title). It's correctly grouped, but the element has a 'printed' value set to true. That's the reason why the title is not appearing. All other mentioned issues, are ok for me on latest dev.

  • zuuperman committed 1ecde5f on 8.x-3.x
    Issue #2768519 by p4trizio, sim_1, zuuperman: Duplicated fields with...
nils.destoop’s picture

Status: Needs work » Fixed

Issue should be fixed in dev

Status: Fixed » Closed (fixed)

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