function system_add_date_formats_form_validate

7.x system.admin.inc system_add_date_formats_form_validate($form, &$form_state)

Validate new date format string submission.

1 string reference to 'system_add_date_formats_form_validate'
system_configure_date_formats_form in drupal-7.x/modules/system/system.admin.inc
Allow users to add additional date formats.

File

drupal-7.x/modules/system/system.admin.inc, line 2914
Admin page callbacks for the system module.

Code

function system_add_date_formats_form_validate($form, &$form_state) {
  $formats = system_get_date_formats('custom');
  $format = trim($form_state['values']['date_format']);
  if (!empty($formats) && in_array($format, array_keys($formats)) && (!isset($form_state['values']['dfid']) || $form_state['values']['dfid'] != $formats[$format]['dfid'])) {
    form_set_error('date_format', t('This format already exists. Enter a unique format string.'));
  }
}