function system_add_date_formats_form_validate

system_add_date_formats_form_validate($form, &$form_state)

Validate new date format string submission.

File

modules/system/system.admin.inc, line 2934
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.'));
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!system!system.admin.inc/function/system_add_date_formats_form_validate/7.x