You are here

function content_admin_field_overview_form_submit in Content Construction Kit (CCK) 6

Same name and namespace in other branches
  1. 5 content_admin.inc \content_admin_field_overview_form_submit()

File

includes/content.admin.inc, line 203
Administrative interface for content type creation.

Code

function content_admin_field_overview_form_submit($form, &$form_state) {
  $form_values = $form_state['values'];

  // Update field weights.
  $extra = array();
  foreach ($form_values as $key => $values) {

    // Groups are handled in fieldgroup_content_overview_form_submit().
    if (in_array($key, $form['#fields'])) {
      db_query("UPDATE {" . content_instance_tablename() . "} SET weight = %d WHERE type_name = '%s' AND field_name = '%s'", $values['weight'], $form['#type_name'], $key);
    }
    elseif (in_array($key, $form['#extra'])) {
      $extra[$key] = $values['weight'];
    }
  }
  if ($extra) {
    variable_set('content_extra_weights_' . $form['#type_name'], $extra);
  }
  else {
    variable_del('content_extra_weights_' . $form['#type_name']);
  }
  content_clear_type_cache();
}