You are here

function calendar_switch_view in Calendar 5

Same name and namespace in other branches
  1. 5.2 calendar.module \calendar_switch_view()

A block with a drop-down list that allows the user to switch between views of the current period

1 string reference to 'calendar_switch_view'
calendar_block in ./calendar.module
implementation of hook_block()

File

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

Code

function calendar_switch_view() {
  $options[''] = t('Calendar');
  $options['list'] = t('List');
  $options['teasers'] = t('Teasers');
  $options['nodes'] = t('Nodes');
  $options['table'] = t('Table');
  $form = array(
    '#method' => 'GET',
    'view' => array(
      '#type' => 'select',
      '#default_value' => $_GET['view'],
      '#options' => $options,
    ),
    'q' => array(
      '#type' => 'hidden',
      '#value' => $_GET['q'],
    ),
    'submit' => array(
      '#type' => 'submit',
      '#value' => t('Switch'),
    ),
  );
  return $form;
}