You are here

function field_group_update_7001 in Field Group 7

Same name and namespace in other branches
  1. 7.2 field_group.install \field_group_update_7001()

Update hook on the field_group table to add an unique identifier.

File

./field_group.install, line 209
Fieldgroup module install file.

Code

function field_group_update_7001() {
  if (!db_field_exists('field_group', 'identifier')) {

    // Add the new string identifier field for ctools.
    db_add_field('field_group', 'identifier', array(
      'type' => 'varchar',
      'length' => 255,
      'not null' => TRUE,
      'default' => '',
      'description' => 'The unique string identifier for a group.',
    ));

    // Force drupal's schema to be rebuilt
    drupal_get_schema('field_group', TRUE);
    module_load_include('module', 'field_group');
    _field_group_recreate_identifiers();
  }
  db_update('system')
    ->fields(array(
    'weight' => 1,
  ))
    ->condition('name', 'field_group')
    ->execute();

  // Clear drupal and static cache.
  field_group_info_groups(NULL, NULL, NULL, TRUE);
}