You are here

function date_field_instance_settings_form_validate in Date 8

Same name and namespace in other branches
  1. 7.3 date.field.inc \date_field_instance_settings_form_validate()
  2. 7 date_admin.inc \date_field_instance_settings_form_validate()
  3. 7.2 date.field.inc \date_field_instance_settings_form_validate()

Form validation handler for _date_field_instance_settings_form().

2 string references to 'date_field_instance_settings_form_validate'
date_field_field_instance_settings_form in date_field/date_field.module
Helper function for date_field_instance_settings_form().
_date_field_instance_settings_form in ./date_admin.inc
Helper function for date_field_instance_settings_form().

File

./date_admin.inc, line 87
Date administration code.

Code

function date_field_instance_settings_form_validate(&$form, &$form_state) {
  $settings = $form_state['values']['instance']['settings'];
  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 End Date is invalid.'));
    }
  }
}