You are here

function fieldgroup_remove_group_submit in Content Construction Kit (CCK) 6.3

Same name and namespace in other branches
  1. 5 fieldgroup.module \fieldgroup_remove_group_submit()
  2. 6 modules/fieldgroup/fieldgroup.module \fieldgroup_remove_group_submit()
  3. 6.2 modules/fieldgroup/fieldgroup.module \fieldgroup_remove_group_submit()
1 string reference to 'fieldgroup_remove_group_submit'
fieldgroup_remove_group in modules/fieldgroup/fieldgroup.module

File

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

Code

function fieldgroup_remove_group_submit($form, &$form_state) {
  $form_values = $form_state['values'];
  $content_type = $form['#content_type'];
  $group_name = $form['#group_name'];
  $parent = db_fetch_array(db_query("SELECT parent FROM {" . fieldgroup_tablename() . "} WHERE group_name = '%s' AND type_name = '%s'", $group_name, $content_type['type']));
  $result = db_query("UPDATE {" . fieldgroup_tablename() . "} SET parent = '%s' WHERE parent = '%s' AND type_name = '%s'", $parent['parent'], $group_name, $content_type['type']);
  $result = db_query("UPDATE {" . fieldgroup_fields_tablename() . "} SET group_name = '%s' WHERE group_name = '%s' AND type_name = '%s'", $parent['parent'], $group_name, $content_type['type']);
  fieldgroup_delete($content_type['type'], $group_name);
  drupal_set_message(t('The group %group_name has been removed.', array(
    '%group_name' => $group_name,
  )));
  $form_state['redirect'] = 'admin/content/node-type/' . $content_type['url_str'] . '/fields';
}