You are here

function _field_group_recreate_identifiers in Field Group 7

Same name and namespace in other branches
  1. 7.2 field_group.module \_field_group_recreate_identifiers()

Utility function to recreate identifiers.

3 calls to _field_group_recreate_identifiers()
field_group_update_7001 in ./field_group.install
Update hook on the field_group table to add an unique identifier.
field_group_update_7002 in ./field_group.install
Update hook to clear cache for new changes to take effect.
field_group_update_7003 in ./field_group.install
Update hook to recreate identifiers.

File

./field_group.module, line 1731
Fieldgroup module.

Code

function _field_group_recreate_identifiers() {

  // Migrate the field groups so they have a unique identifier.
  $result = db_select('field_group', 'fg')
    ->fields('fg')
    ->execute();
  $rows = array();
  foreach ($result as $row) {
    $row->identifier = $row->group_name . '|' . $row->entity_type . '|' . $row->bundle . '|' . $row->mode;
    $row->data = unserialize($row->data);
    $rows[] = $row;
  }
  foreach ($rows as $row) {
    drupal_write_record('field_group', $row, array(
      'id',
    ));
  }
}