You are here

function hook_date_restrictions_element_validate in Date Restrictions 7

Validates input date.

Related topics

2 functions implement hook_date_restrictions_element_validate()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

date_restrictions_allowed_values_date_restrictions_element_validate in modules/allowed_values/date_restrictions_allowed_values.date_restrictions.inc
Implements hook_date_restrictions_element_validate().
date_restrictions_minmax_date_restrictions_element_validate in modules/minmax/date_restrictions_minmax.date_restrictions.inc
Implements hook_date_restrictions_element_validate().

File

./date_restrictions.api.php, line 54
Hooks provided by the Date Restrictions module.

Code

function hook_date_restrictions_element_validate($date, $element, $form_state, $form) {
  $min = new DateObject();
  interval_apply_interval($min, $element['#restrictions']['date_min']);
  if ($date < $min) {
    return form_error($element, t('Invalid date.'));
  }
}