You are here

public function Mini::query in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/views/src/Plugin/views/pager/Mini.php \Drupal\views\Plugin\views\pager\Mini::query()

Modify the query for paging

This is called during the build phase and can directly modify the query.

Overrides SqlBase::query

File

core/modules/views/src/Plugin/views/pager/Mini.php, line 52
Contains \Drupal\views\Plugin\views\pager\Mini.

Class

Mini
The plugin to handle mini pager.

Namespace

Drupal\views\Plugin\views\pager

Code

public function query() {
  parent::query();

  // 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);
  }
}