You are here

function fieldgroup_save_group in Content Construction Kit (CCK) 6.2

Same name and namespace in other branches
  1. 5 fieldgroup.module \fieldgroup_save_group()
  2. 6.3 modules/fieldgroup/fieldgroup.module \fieldgroup_save_group()
  3. 6 modules/fieldgroup/fieldgroup.module \fieldgroup_save_group()
4 calls to fieldgroup_save_group()
content_copy_import_form_submit in modules/content_copy/content_copy.module
Submit handler for import form. For each submitted field: 1) add new field to the database 2) execute the imported field macro to update the settings to the imported values
fieldgroup_display_overview_form_submit in modules/fieldgroup/fieldgroup.module
fieldgroup_field_overview_form_submit in modules/fieldgroup/fieldgroup.module
fieldgroup_group_edit_form_submit in modules/fieldgroup/fieldgroup.module

File

modules/fieldgroup/fieldgroup.module, line 797
Create field groups for CCK fields.

Code

function fieldgroup_save_group($type_name, $group) {
  $groups = fieldgroup_groups($type_name);

  // Allow other modules to intervene when the group is saved.
  foreach (module_implements('fieldgroup_save_group') as $module) {
    $function = $module . '_fieldgroup_save_group';
    $function($group);
  }
  if (!isset($groups[$group['group_name']])) {

    // Accept group name from programmed submissions if valid.
    db_query("INSERT INTO {" . fieldgroup_tablename() . "} (group_type, type_name, group_name, label, settings, weight)" . " VALUES ('%s', '%s', '%s', '%s', '%s', %d)", $group['group_type'], $type_name, $group['group_name'], $group['label'], serialize($group['settings']), $group['weight']);
    cache_clear_all('fieldgroup_data:', content_cache_tablename(), TRUE);
    return SAVED_NEW;
  }
  else {
    db_query("UPDATE {" . fieldgroup_tablename() . "} SET group_type = '%s', label = '%s', settings = '%s', weight = %d " . "WHERE type_name = '%s' AND group_name = '%s'", $group['group_type'], $group['label'], serialize($group['settings']), $group['weight'], $type_name, $group['group_name']);
    cache_clear_all('fieldgroup_data:', content_cache_tablename(), TRUE);
    return SAVED_UPDATED;
  }
}