1.20.x date.api.php | hook_date_popup_process_alter(&$element, &$form_state, $context) |
Alter the date_popup widget element.
Parameters
array $element: An associative array containing the properties of the date_popup 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
File
- modules/
date/ date.api.php, line 299 - Hooks provided by the Date module.
Code
function hook_date_popup_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 != '' && array_key_exists('time', $element)) {
$element['time']['#states'] = array(
'visible' => array(
'input[name="' . $all_day_id . '"]' => array('checked' => FALSE),
),
);
}
}