You are here

function content_field_edit_form_submit in Content Construction Kit (CCK) 6.2

Same name and namespace in other branches
  1. 6.3 includes/content.admin.inc \content_field_edit_form_submit()

Save a field's settings after editing.

File

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

Code

function content_field_edit_form_submit($form, &$form_state) {
  module_load_include('inc', 'content', 'includes/content.crud');
  $form_values = $form_state['values'];
  content_field_instance_update($form_values);
  $destinations = !empty($_REQUEST['destinations']) ? $_REQUEST['destinations'] : array();

  // Remove any external URLs.
  $destinations = array_diff($destinations, array_filter($destinations, 'menu_path_is_external'));
  if ($destinations) {
    drupal_set_message(t('Added field %label.', array(
      '%label' => $form_values['label'],
    )));
    $form_state['redirect'] = content_get_destinations($destinations);
  }
  else {
    drupal_set_message(t('Saved field %label.', array(
      '%label' => $form_values['label'],
    )));
    $type = content_types($form_values['type_name']);
    $form_state['redirect'] = 'admin/content/node-type/' . $type['url_str'] . '/fields';
  }
}