function Mini::query

Same name in other branches
  1. 9 core/modules/views/src/Plugin/views/pager/Mini.php \Drupal\views\Plugin\views\pager\Mini::query()
  2. 8.9.x core/modules/views/src/Plugin/views/pager/Mini.php \Drupal\views\Plugin\views\pager\Mini::query()
  3. 11.x core/modules/views/src/Plugin/views/pager/Mini.php \Drupal\views\Plugin\views\pager\Mini::query()

Overrides SqlBase::query

File

core/modules/views/src/Plugin/views/pager/Mini.php, line 49

Class

Mini
The plugin to handle mini pager.

Namespace

Drupal\views\Plugin\views\pager

Code

public function query() {
    parent::query();
    // Only modify the query if we don't want to do a total row count.
    if (!$this->view->get_total_rows) {
        // Don't query for the next page if we have a pager that has a limited
        // amount of pages.
        if ($this->getItemsPerPage() > 0 && (empty($this->options['total_pages']) || $this->getCurrentPage() < $this->options['total_pages'])) {
            // Increase the items in the query in order to be able to find out
            // whether there is another page.
            $limit = $this->view->query
                ->getLimit();
            $limit += 1;
            $this->view->query
                ->setLimit($limit);
        }
    }
}

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