function system_add_date_format_type_form_validate
system_add_date_format_type_form_validate($form, &$form_state)
Validate system_add_date_format_type form submissions.
File
- modules/system/system.admin.inc, line 2171
- Admin page callbacks for the system module.
Code
function system_add_date_format_type_form_validate($form, &$form_state) { if (!empty($form_state['values']['machine_name']) && !empty($form_state['values']['date_type'])) { if (!preg_match("/^[a-zA-Z0-9_]+$/", trim($form_state['values']['machine_name']))) { form_set_error('machine_name', t('The date type must contain only alphanumeric characters and underscores.')); } $types = system_get_date_types(); if (in_array(trim($form_state['values']['machine_name']), array_keys($types))) { form_set_error('machine_name', t('This date type already exists. Enter a unique type.')); } } }
© 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_format_type_form_validate/7.x