You are here

function date_views_plugin_pager::options_form in Date 8

Same name and namespace in other branches
  1. 7.3 date_views/includes/date_views_plugin_pager.inc \date_views_plugin_pager::options_form()
  2. 7.2 date_views/includes/date_views_plugin_pager.inc \date_views_plugin_pager::options_form()

File

date_views/includes/date_views_plugin_pager.inc, line 88
Date pager. Works with a Date argument, the argument filters the view and the pager provides back/next navigation.

Class

date_views_plugin_pager
Example plugin to handle paging by month.

Code

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['date_argument']['#type'] = 'hidden';
  $form['date_argument']['#value'] = $this->options['date_argument'];
  $form['granularity']['#type'] = 'hidden';
  $form['granularity']['#value'] = $this->options['granularity'];
}