function _datex_popup_authored_form in Datex 7.3
From date_popup_authored.
2 calls to _datex_popup_authored_form()
- datex_popup_form_alter in datex_popup/
form.inc - Implements hook_form_alter().
- datex_popup_form_node_form_alter in datex_popup/
form.inc - Datexifies node authored on date form element.
File
- datex_popup/
form.inc, line 11 - Alter date_popup element in various forms.
Code
function _datex_popup_authored_form(&$form, $form_state) {
$el =& $form['author']['date'];
$calendar = datex_factory(NULL, NULL, 'en');
if (!$calendar) {
return;
}
$el['#type'] = 'date_popup';
if (!empty($el['#default_value'])) {
$fmt = 'Y-m-d H:i:s O';
$date_obj = date_create_from_format($fmt, $el['#default_value']);
if ($date_obj) {
$calendar
->setTimestamp($date_obj
->format('U'));
$el['#default_value'] = $calendar
->xFormat('Y-m-d H:i:s');
}
}
$el['#date_year_range'] = '-50:+50';
$el['#date_format'] = 'Y-m-d H:i:s';
unset($el['#maxlength']);
unset($el['#description']);
$el['#after_build'][] = '_datex_popup_authored_element_after_build';
$form['#submit'][] = '_datex_popup_authored_form_submit';
}