You are here

function system_add_date_formats_form_submit in Drupal 7

Process new date format string submission.

1 string reference to 'system_add_date_formats_form_submit'
system_configure_date_formats_form in modules/system/system.admin.inc
Allow users to add additional date formats.

File

modules/system/system.admin.inc, line 2960
Admin page callbacks for the system module.

Code

function system_add_date_formats_form_submit($form, &$form_state) {
  $format = array();
  $format['format'] = trim($form_state['values']['date_format']);
  $format['type'] = 'custom';
  $format['locked'] = 0;
  if (!empty($form_state['values']['dfid'])) {
    system_date_format_save($format, $form_state['values']['dfid']);
    drupal_set_message(t('Custom date format updated.'));
  }
  else {
    $format['is_new'] = 1;
    system_date_format_save($format);
    drupal_set_message(t('Custom date format added.'));
  }
  $form_state['redirect'] = 'admin/config/regional/date-time/formats';
}