You are here

function hook_date_combo_validate_date_end_alter in Date 8

Same name and namespace in other branches
  1. 7.3 date.api.php \hook_date_combo_validate_date_end_alter()
  2. 7.2 date.api.php \hook_date_combo_validate_date_end_alter()

Alter the local end date objects created by the date_combo validation.

This is called before the objects are converted back to the database timezone and stored.

Parameters

object $date: The $date object.

array $form_state: A keyed array containing the current state of the form.

array $context: An associative array containing the following keys:

  • field: The $field array.
  • instance: The $instance array.
  • item: The $item array.
  • element: The $element array.
1 function implements hook_date_combo_validate_date_end_alter()

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

date_all_day_date_combo_validate_date_end_alter in date_all_day/date_all_day.module
Implements hook_date_combo_validate_date_end_alter().
1 invocation of hook_date_combo_validate_date_end_alter()
date_combo_validate in ./date_elements.inc
Validate and update a combo element. Don't try this if there were errors before reaching this point.

File

./date.api.php, line 218
Hooks provided by the Date module.

Code

function hook_date_combo_validate_date_end_alter(&$date, &$form_state, $context) {

  // If this is an 'All day' value, set the time to midnight.
  if (!empty($context['element']['#date_is_all_day'])) {
    $date
      ->setTime(0, 0, 0);
  }
}