You are here

function calendar_date_select_form in Calendar 7.2

Same name and namespace in other branches
  1. 5.2 calendar.module \calendar_date_select_form()
  2. 6.2 calendar.module \calendar_date_select_form()
  3. 7 calendar.module \calendar_date_select_form()

The date selector form.

@TODO is the title desired here or does it take up too much space??

Parameters

object $view:

Return value

the form element

1 string reference to 'calendar_date_select_form'
calendar_date_select in ./calendar.module
A selector to jump to a new date in the calendar.

File

./calendar.module, line 372
Adds calendar filtering and displays to Views.

Code

function calendar_date_select_form($form, &$form_state, $view) {
  $format = date_limit_format(variable_get('date_format_short', 'm/d/Y - H:i'), array(
    'year',
    'month',
    'day',
  ));
  $form['calendar_goto'] = array(
    //'#title' => t('Calendar date'),
    '#type' => module_exists('date_popup') ? 'date_popup' : 'date_select',
    '#default_value' => date_format($view->date_info->min_date, 'Y-m-d'),
    '#date_timezone' => date_default_timezone(),
    '#date_format' => $format,
  );
  $form['calendar_type'] = array(
    '#type' => 'hidden',
    '#value' => $view->date_info->calendar_type,
  );
  $form['view_name'] = array(
    '#type' => 'hidden',
    '#value' => $view->name,
  );
  $form['view_url'] = array(
    '#type' => 'hidden',
    '#value' => $view
      ->get_url(),
  );
  $pos = calendar_arg_position($view);
  $form['calendar_previous_arg'] = array(
    '#type' => 'hidden',
    '#value' => $view->args[$pos],
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Change date'),
  );
  return $form;
}