1 date_views_plugin_pager.inc public date_views_plugin_pager::options_form(&$form, &$form_state)

Provide the form for setting options.

Overrides views_plugin::options_form

File

core/modules/date/views/date_views_plugin_pager.inc, line 104
Date views pager plugin.

Class

date_views_plugin_pager
Date views pager plugin.

Code

public function options_form(&$form, &$form_state) {
  $form['markup']['#markup'] = t('This pager works together with a Date or Content date field contextual filter. If a Date filter has been added to the view, this pager will provide back/next paging to match the granularity of that filter (i.e. paging by year, month, week, or day). The filter must also be configured to use a DATE default value. If there is no Date contextual filter on this view, or if it has not been set to use a default date, the pager will not appear.');
  $form['date_id'] = array(
    '#title' => t('Date identifier'),
    '#type' => 'textfield',
    '#description' => t('The query identifier to use when fetching date data from in the URL. Note that if you have more than one display in the same view that uses the date pager (like a page and a block), the pager id must be different for each one or both will change when the pager value changes.'),
    '#default_value' => $this->options['date_id'],
    '#required' => TRUE,
  );
  $form['pager_position'] = array(
    '#title' => t('Pager position'),
    '#type' => 'select',
    '#options' => array(
      'bottom' => t('Bottom'),
      'top' => t('Top'),
      'both' => t('Both'),
    ),
    '#description' => t('Where to place the date pager, on the top, bottom, or both top and bottom of the content.'),
    '#default_value' => $this->options['pager_position'],
    '#required' => TRUE,
  );
  $form['link_format'] = array(
    '#title' => t('Link format'),
    '#type' => 'select',
    '#options' => array('pager' => t('Pager'), 'clean' => t('Clean URL')),
    '#description' => t("The format for pager link urls. With the Pager format, the links look like 'calendar/?date=2020-05'. The Clean URL format links look like 'calendar/2020-05'. The Clean format links look nicer but the Pager format links are likely to work better if the calendar is used in blocks or panels."),
    '#default_value' => $this->options['link_format'],
    '#required' => TRUE,
  );
  $form['skip_empty_pages'] = array(
    '#title' => t('Skip empty pages'),
    '#type' => 'checkbox',
    '#description' => t('When selected, the pager will not display pages with no result for the given date. This causes a slight performance degradation because two additional queries need to be executed.'),
    '#default_value' => $this->options['skip_empty_pages'],
  );
  $form['date_argument']['#type'] = 'hidden';
  $form['date_argument']['#value'] = $this->options['date_argument'];
  $form['granularity']['#type'] = 'hidden';
  $form['granularity']['#value'] = $this->options['granularity'];
}