You are here

protected function SqlBase::defineOptions in Drupal 9

Same name and namespace in other branches
  1. 8 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()

Information about options for all kinds of purposes will be held here.


'option_name' => array(
 - 'default' => default value,
 - 'contains' => (optional) array of items this contains, with its own
     defaults, etc. If contains is set, the default will be ignored and
     assumed to be array().
 ),

Return value

array Returns the options of this handler/plugin.

Overrides PluginBase::defineOptions

2 calls to SqlBase::defineOptions()
Full::defineOptions in core/modules/views/src/Plugin/views/pager/Full.php
Information about options for all kinds of purposes will be held here.
Mini::defineOptions in core/modules/views/src/Plugin/views/pager/Mini.php
Overrides \Drupal\views\Plugin\views\pager\PagerPlugin::defineOptions().
2 methods override SqlBase::defineOptions()
Full::defineOptions in core/modules/views/src/Plugin/views/pager/Full.php
Information about options for all kinds of purposes will be held here.
Mini::defineOptions in core/modules/views/src/Plugin/views/pager/Mini.php
Overrides \Drupal\views\Plugin\views\pager\PagerPlugin::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;
}