You are here

public function ViewExecutable::initPager in Views (for Drupal 7) 8.3

Initialize the pager

Like style initialization, pager initialization is held until late to allow for overrides.

File

lib/Drupal/views/ViewExecutable.php, line 719
Definition of Drupal\views\ViewExecutable.

Class

ViewExecutable
An object to contain all of the data to generate a view, plus the member functions to build the view query, execute the query and render the output.

Namespace

Drupal\views

Code

public function initPager() {
  if (!isset($this->pager)) {
    $this->pager = $this->display_handler
      ->getPlugin('pager');
    if ($this->pager
      ->use_pager()) {
      $this->pager
        ->set_current_page($this->current_page);
    }

    // These overrides may have been set earlier via $view->set_*
    // functions.
    if (isset($this->items_per_page)) {
      $this->pager
        ->set_items_per_page($this->items_per_page);
    }
    if (isset($this->offset)) {
      $this->pager
        ->set_offset($this->offset);
    }
  }
}