You are here

function hook_date_select_process_alter in Date 8

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

Alter the date_select widget element.

Parameters

array $element: An associative array containing the properties of the date_select element.

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

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

  • form: Nested array of form elements that comprise the form.

See also

date_select_element_process()

1 function implements hook_date_select_process_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_select_process_alter in date_all_day/date_all_day.module
Implements hook_date_select_process_alter().

File

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

Code

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

  // Hide or show the element in reaction to the all_day status for the element.
  $all_day_id = !empty($element['#date_all_day_id']) ? $element['#date_all_day_id'] : '';
  if ($all_day_id != '') {
    foreach (array(
      'hour',
      'minute',
      'second',
      'ampm',
    ) as $field) {
      if (array_key_exists($field, $element)) {
        $element[$field]['#states'] = array(
          'visible' => array(
            'input[name="' . $all_day_id . '"]' => array(
              'checked' => FALSE,
            ),
          ),
        );
      }
    }
  }
}