You are here

function fieldgroup_content_admin_form_submit in Content Construction Kit (CCK) 5

Same name and namespace in other branches
  1. 6 modules/fieldgroup/fieldgroup.module \fieldgroup_content_admin_form_submit()
1 call to fieldgroup_content_admin_form_submit()
content_admin_field_overview_form_submit in ./content_admin.inc

File

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

Code

function fieldgroup_content_admin_form_submit($form_id, &$form_values, $default) {
  if ($default != $form_values['group']) {
    if ($form_values['group'] && !$default) {
      db_query("INSERT INTO {node_group_fields} (type_name, group_name, field_name) VALUES ('%s', '%s', '%s')", $form_values['type_name'], $form_values['group'], $form_values['field_name']);
    }
    else {
      if ($form_values['group']) {
        db_query("UPDATE {node_group_fields} 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 {node_group_fields} WHERE type_name = '%s' AND field_name = '%s'", $form_values['type_name'], $form_values['field_name']);
      }
    }
    cache_clear_all('fieldgroup_data', 'cache_content');
  }
}