function date_popup_process in Date 6.2
Same name and namespace in other branches
- 5.2 date_popup/date_popup.module \date_popup_process()
- 6 date_popup/date_popup.module \date_popup_process()
Javascript popup element processing. Add popup attributes to $element.
In regular FAPI processing $element['#value'] will contain a string value before the form is submitted, and an array during submission.
In regular FAPI processing $edit is empty until the form is submitted when it will contain an array.
Views widget processing now receives the same values as normal FAPI processing (that was not true in Views 1).
1 string reference to 'date_popup_process'
- date_popup_elements in date_popup/
date_popup.module - Implementation of hook_elements().
File
- date_popup/
date_popup.module, line 249 - A module to enable jquery calendar and time entry popups. Requires the Date API.
Code
function date_popup_process($element, $edit, $form_state, $form) {
date_popup_load();
require_once './' . drupal_get_path('module', 'date_api') . '/date_api_elements.inc';
$date = NULL;
$granularity = date_format_order($element['#date_format']);
if (!empty($edit) && is_array($edit) && !empty($edit['date'])) {
$datetime = date_popup_input_value($element);
$date = date_make_date($datetime, $element['#date_timezone'], DATE_DATETIME, $granularity);
}
elseif (!empty($element['#value'])) {
$date = date_make_date($element['#value'], $element['#date_timezone'], DATE_DATETIME, $granularity);
}
date_increment_round($date, $element['#date_increment']);
$granularity = date_format_order($element['#date_format']);
$element['#tree'] = TRUE;
$element['#granularity'] = $granularity;
$element['date'] = date_popup_process_date($element, $edit, $date);
$element['time'] = date_popup_process_time($element, $edit, $date);
if (isset($element['#element_validate'])) {
array_push($element['#element_validate'], 'date_popup_validate');
}
else {
$element['#element_validate'] = array(
'date_popup_validate',
);
}
return $element;
}