function date_field_instance_settings_form_validate in Date 7
Same name and namespace in other branches
- 8 date_admin.inc \date_field_instance_settings_form_validate()
- 7.3 date.field.inc \date_field_instance_settings_form_validate()
- 7.2 date.field.inc \date_field_instance_settings_form_validate()
1 string reference to 'date_field_instance_settings_form_validate'
File
- ./
date_admin.inc, line 224 - Date administration code. Moved to separate file since there is a lot of code here that is not needed often.
Code
function date_field_instance_settings_form_validate(&$form, &$form_state) {
// The instance settings are in the wrong place in the form because of #tree on the top level.
$settings = $form_state['values']['instance']['settings'];
$settings = array_merge($settings, $settings['default']);
unset($settings['default']);
form_set_value(array(
'#parents' => array(
'instance',
'settings',
),
), $settings, $form_state);
if ($settings['default_value'] == 'strtotime') {
$is_strtotime = @strtotime($settings['default_value_code']);
if (!$is_strtotime) {
form_set_error('instance][settings][default_value_code', t('The Strtotime default value is invalid.'));
}
}
if (isset($settings['default_value2']) && $settings['default_value2'] == 'strtotime') {
$is_strtotime = @strtotime($settings['default_value_code2']);
if (!$is_strtotime) {
form_set_error('instance][settings][default_value_code2', t('The Strtotime default value for the To Date is invalid.'));
}
}
}