You are here

function fieldgroup_content_overview_form_submit in Content Construction Kit (CCK) 6

1 string reference to 'fieldgroup_content_overview_form_submit'
fieldgroup_form_alter in modules/fieldgroup/fieldgroup.module

File

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

Code

function fieldgroup_content_overview_form_submit($form, &$form_state) {
  $form_values = $form_state['values'];
  $type_name = $form['#type_name'];
  foreach ($form_values as $key => $values) {

    // Update field parenting.
    if (in_array($key, $form['#fields'])) {

      // TODO : check the parent group does exist ?
      fieldgroup_update_fields(array(
        'field_name' => $key,
        'group' => $values['parent'],
        'type_name' => $type_name,
      ));
    }
    elseif (in_array($key, $form['#groups'])) {
      db_query("UPDATE {" . fieldgroup_tablename() . "} SET weight = %d WHERE type_name = '%s' AND group_name = '%s'", $values['weight'], $type_name, $key);
    }
  }
  cache_clear_all('fieldgroup_data', content_cache_tablename());
}