3 namespace Drupal\views\Plugin\views\pager;
5 use Drupal\Core\Form\FormStateInterface;
8 * The plugin to handle full pager.
10 * @ingroup views_pager_plugins
14 * title = @Translation("Paged output, full pager"),
15 * short_title = @Translation("Full"),
16 * help = @Translation("Paged output, full Drupal style"),
18 * register_theme = FALSE
21 class Full extends SqlBase {
26 protected function defineOptions() {
27 $options = parent::defineOptions();
29 // Use the same default quantity that core uses by default.
30 $options['quantity'] = ['default' => 9];
32 $options['tags']['contains']['first'] = ['default' => $this->t('« First')];
33 $options['tags']['contains']['last'] = ['default' => $this->t('Last »')];
41 public function buildOptionsForm(&$form, FormStateInterface $form_state) {
42 parent::buildOptionsForm($form, $form_state);
46 '#title' => $this->t('Number of pager links visible'),
47 '#description' => $this->t('Specify the number of links to pages to display in the pager.'),
48 '#default_value' => $this->options['quantity'],
51 $form['tags']['first'] = [
52 '#type' => 'textfield',
53 '#title' => $this->t('First page link text'),
54 '#default_value' => $this->options['tags']['first'],
58 $form['tags']['last'] = [
59 '#type' => 'textfield',
60 '#title' => $this->t('Last page link text'),
61 '#default_value' => $this->options['tags']['last'],
69 public function summaryTitle() {
70 if (!empty($this->options['offset'])) {
71 return $this->formatPlural($this->options['items_per_page'], '@count item, skip @skip', 'Paged, @count items, skip @skip', ['@count' => $this->options['items_per_page'], '@skip' => $this->options['offset']]);
73 return $this->formatPlural($this->options['items_per_page'], '@count item', 'Paged, @count items', ['@count' => $this->options['items_per_page']]);
79 public function render($input) {
80 // The 0, 1, 3, 4 indexes are correct. See the template_preprocess_pager()
83 0 => $this->options['tags']['first'],
84 1 => $this->options['tags']['previous'],
85 3 => $this->options['tags']['next'],
86 4 => $this->options['tags']['last'],
89 '#theme' => $this->themeFunctions(),
91 '#element' => $this->options['id'],
92 '#parameters' => $input,
93 '#quantity' => $this->options['quantity'],
94 '#route_name' => !empty($this->view->live_preview) ? '<current>' : '<none>',