With a little side of applesauce...

Thursday, August 23, 2012

Drupal 7 - date_popup options

I'm pulling this from the source code so that I can reference it more easily:
* #date_timezone
 *   The local timezone to be used to create this date.
 *
 * #date_format
 *   Unlike earlier versions of this popup, most formats will work.
 *
 * #date_increment
 *   Increment minutes and seconds by this amount, default is 1.
 *
 * #date_year_range
 *   The number of years to go back and forward in a year selector,
 *   default is -3:+3 (3 back and 3 forward).
 *
 * #datepicker_options
 *   An associative array representing the jQuery datepicker options you want
 *   to set for this element. Use the jQuery datepicker option names as keys.
 *   Hard coded defaults are:
 *   - changeMonth => TRUE
 *   - changeYear => TRUE
 *   - autoPopUp => 'focus'
 *   - closeAtTop => FALSE
 *   - speed => 'immediate'
 */
function date_popup_element_info() {
  $timepicker = date_popup_get_preferred_timepicker();
  $type['date_popup'] = array(
    '#input' => TRUE,
    '#tree' => TRUE,
    '#date_timezone' => date_default_timezone(),
    '#date_flexible' => 0,
    '#date_format' => variable_get('date_format_short', 'm/d/Y - H:i'),
    '#datepicker_options' => array(),
    '#timepicker' => variable_get('date_popup_timepicker', $timepicker),
    '#date_increment' => 1,
    '#date_year_range' => '-3:+3',
    '#date_label_position' => 'above',
    '#process' => array('date_popup_element_process'),
    '#value_callback' => 'date_popup_element_value_callback',
    '#theme_wrappers' => array('date_popup'),
  );

No comments: