You are here

function date_all_day_date_combo_pre_validate_alter in Date 7.3

Same name and namespace in other branches
  1. 8 date_all_day/date_all_day.module \date_all_day_date_combo_pre_validate_alter()
  2. 7.2 date_all_day/date_all_day.module \date_all_day_date_combo_pre_validate_alter()

Implements hook_date_combo_pre_validate_alter().

File

date_all_day/date_all_day.module, line 308
Adds All Day functionality to the Date field.

Code

function date_all_day_date_combo_pre_validate_alter(&$element, &$form_state, $context) {

  // This hook lets the element or the form_state be altered before the rest of
  // the date_combo validation gets fired.
  if (!empty($context['item']['all_day'])) {
    $field = $context['field'];

    // If there is an all day flag on this date and the time is empty, change
    // the format to match the input value so it doesn't get validation errors.
    $element['#date_is_all_day'] = TRUE;
  }
}