You are here

function date_all_day_value in Date 7.2

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

A helper function date_all_day_value().

6 calls to date_all_day_value()
date_all_day_date_popup_pre_validate_alter in date_all_day/date_all_day.module
Implements hook_date_select_pre_validate_alter().
date_all_day_date_select_pre_validate_alter in date_all_day/date_all_day.module
Implements hook_date_select_pre_validate_alter().
date_all_day_date_text_pre_validate_alter in date_all_day/date_all_day.module
Implements hook_date_select_pre_validate_alter().
hook_date_popup_pre_validate_alter in ./date.api.php
Alter the date_popup element before the rest of the validation is run.
hook_date_select_pre_validate_alter in ./date.api.php
Alter the date_select element before the rest of the validation is run.

... See full list

File

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

Code

function date_all_day_value(&$element, $form_state) {

  // To check if the all day flag is set on the parent of an element, and
  // adjust the date_format accordingly so the missing time will not cause
  // validation errors.
  if (!empty($element['#date_all_day_id'])) {
    $parents = $element['#parents'];
    array_pop($parents);
    $parent_element = drupal_array_get_nested_value($form_state['values'], $parents);
    if (!empty($parent_element) && !empty($parent_element['all_day'])) {
      $element['#date_format'] = date_part_format('date', $element['#date_format']);
      return $parent_element['all_day'];
    }
  }
  return FALSE;
}