You are here

function hook_date_combo_validate_date_start_alter in Date 7.2

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

Alter the local start 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_start_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_start_alter in date_all_day/date_all_day.module
Implements hook_date_combo_validate_date_start_alter().
1 invocation of hook_date_combo_validate_date_start_alter()
date_combo_validate in ./date_elements.inc
Validate and update a combo element.

File

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

Code

function hook_date_combo_validate_date_start_alter(object &$date, array &$form_state, array $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);
  }
}