I was upgrading a site from Drupal 6 to Drupal 7 that had field groups in Drupal 6.

I was surprised when my converted content types appeared to not have any groups. I looked at the issue queue for this module and it appeared that the conversion is supposed to happen when the module is installed (not sure why it should be done then and not part of hook_update_7000 as per http://api.drupal.org/api/drupal/modules%21system%21system.api.php/funct...).

As I poked around the tables I noticed I had 17 records in my content_group table, two of which were multigroups and not expected to upgrade. I also noticed I had 15 records in my field_group table. So in theory I was expecting my groups converted. It turned out there's a 3 to 1 expansion going to Drupal 7 and in reality only 5 groups converted. That coincidence caused some of my confusion.

It turned out the site had the same group names in several content types, allowed by Drupal 6. When _field_group_read_groups queried the content_group table it did find 17 records, but when it saved them into the $groups array returned as the result, the index was the group_name, which in this case had duplicates in several content types.

I was able to resolve the issue by using type_name plus underscore plus group_name as the index for the $groups array. That $groups array result is only used by field_group_install and then only in a foreach statement that doesn't use the key values.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

greggmarshall’s picture

Patch to fix the issue is attached.

ttrafford’s picture

#1 works perfectly for me.

greggmarshall’s picture

Status: Active » Needs review

Let's move it to needs review.

nils.destoop’s picture

Status: Needs review » Closed (fixed)

This was already fixed.