| 7 system.admin.inc | system_add_date_format_type_form_validate($form, &$form_state) |
| 8 system.admin.inc | system_add_date_format_type_form_validate($form, &$form_state) |
Validate system_add_date_format_type form submissions.
1 string reference to 'system_add_date_format_type_form_validate'
File
- modules/
system/ system.admin.inc, line 2145 - 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.'));
}
}
}
Login or register to post comments