function SqlBase::defineOptions

Same name and namespace in other branches
  1. 11.x core/modules/views/src/Plugin/views/pager/SqlBase.php \Drupal\views\Plugin\views\pager\SqlBase::defineOptions()
  2. 10 core/modules/views/src/Plugin/views/pager/SqlBase.php \Drupal\views\Plugin\views\pager\SqlBase::defineOptions()
  3. 8.9.x core/modules/views/src/Plugin/views/pager/SqlBase.php \Drupal\views\Plugin\views\pager\SqlBase::defineOptions()

File

core/modules/views/src/Plugin/views/pager/SqlBase.php, line 65

Class

SqlBase
A common base class for sql based pager.

Namespace

Drupal\views\Plugin\views\pager

Code

protected function defineOptions() {
  $options = parent::defineOptions();
  $options['items_per_page'] = [
    'default' => 10,
  ];
  $options['offset'] = [
    'default' => 0,
  ];
  $options['id'] = [
    'default' => 0,
  ];
  $options['total_pages'] = [
    'default' => '',
  ];
  $options['expose'] = [
    'contains' => [
      'items_per_page' => [
        'default' => FALSE,
      ],
      'items_per_page_label' => [
        'default' => $this->t('Items per page'),
      ],
      'items_per_page_options' => [
        'default' => '5, 10, 25, 50',
      ],
      'items_per_page_options_all' => [
        'default' => FALSE,
      ],
      'items_per_page_options_all_label' => [
        'default' => $this->t('- All -'),
      ],
      'offset' => [
        'default' => FALSE,
      ],
      'offset_label' => [
        'default' => $this->t('Offset'),
      ],
    ],
  ];
  $options['tags'] = [
    'contains' => [
      'previous' => [
        'default' => $this->t('‹ Previous'),
      ],
      'next' => [
        'default' => $this->t('Next ›'),
      ],
    ],
  ];
  return $options;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.