You are here

function date_all_day_value in Date 7.3

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

Ensure date fields have the all-day flag set.

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.

@todo Is the return value used anywhere?

Return value

bool Whether this field is configured to allow all-day values.

See also

date_all_day_date_popup_pre_validate_alter()

date_all_day_date_select_pre_validate_alter()

date_all_day_date_text_pre_validate_alter()

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 293
Adds All Day functionality to the Date field.

Code

function date_all_day_value(&$element, $form_state) {
  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'])) {
      return $parent_element['all_day'];
    }
  }
  return FALSE;
}