You are here

function fieldgroup_update_fields in Content Construction Kit (CCK) 6

Same name and namespace in other branches
  1. 6.3 modules/fieldgroup/fieldgroup.module \fieldgroup_update_fields()
  2. 6.2 modules/fieldgroup/fieldgroup.module \fieldgroup_update_fields()
2 calls to fieldgroup_update_fields()
fieldgroup_content_admin_form_submit in modules/fieldgroup/fieldgroup.module
fieldgroup_content_overview_form_submit in modules/fieldgroup/fieldgroup.module

File

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

Code

function fieldgroup_update_fields($form_values) {
  $default = _fieldgroup_field_get_group($form_values['type_name'], $form_values['field_name']);
  if ($default != $form_values['group']) {
    if ($form_values['group'] && !$default) {
      db_query("INSERT INTO {" . fieldgroup_fields_tablename() . "} (type_name, group_name, field_name) VALUES ('%s', '%s', '%s')", $form_values['type_name'], $form_values['group'], $form_values['field_name']);
    }
    elseif ($form_values['group']) {
      db_query("UPDATE {" . fieldgroup_fields_tablename() . "} SET group_name = '%s' WHERE type_name = '%s' AND field_name = '%s'", $form_values['group'], $form_values['type_name'], $form_values['field_name']);
    }
    else {
      db_query("DELETE FROM {" . fieldgroup_fields_tablename() . "} WHERE type_name = '%s' AND field_name = '%s'", $form_values['type_name'], $form_values['field_name']);
    }
    cache_clear_all('fieldgroup_data', content_cache_tablename());
  }
}