You are here

function name_custom_formats_form_submit in Name Field 7

Same name and namespace in other branches
  1. 6 name.admin.inc \name_custom_formats_form_submit()

Submit handler for name_custom_formats_form().

File

./name.admin.inc, line 402
General administration functions.

Code

function name_custom_formats_form_submit($form, &$form_state) {
  $values = $form_state['values'];
  if (empty($values['ncfid'])) {
    drupal_write_record('name_custom_format', $values);
    $message = 'Custom format %name has been created.';
  }
  else {
    drupal_write_record('name_custom_format', $values, 'ncfid');
    $message = 'Custom format %name has been updated.';
  }
  drupal_set_message(t($message, array(
    '%name' => $values['name'],
  )));

  // Reset the static so the next load will pickup any name changes.
  drupal_static_reset('name_get_format_by_machine_name');
  $form_state['redirect'] = 'admin/config/content/name';
}