function date_date_time_settings_validate in Date 6.2
Validate new date format type details.
1 string reference to 'date_date_time_settings_validate'
- date_form_date_api_date_formats_form_alter in date/
date.module - Implementation of hook_form_alter().
File
- date/
date.module, line 769 - Defines date/time field types for the Content Construction Kit (CCK).
Code
function date_date_time_settings_validate($form, &$form_state) {
if (!empty($form_state['values']['add_date_format_type']) && !empty($form_state['values']['add_date_format_title'])) {
if (!preg_match("/^[a-zA-Z0-9_]+\$/", $form_state['values']['add_date_format_type'])) {
form_set_error('add_date_format_type', t('The format type must contain only alphanumeric characters and underscores.'));
}
$types = date_get_format_types();
if (in_array($form_state['values']['add_date_format_type'], array_keys($types))) {
form_set_error('add_date_format_type', t('This format type already exists. Please enter a unique type.'));
}
}
}