ViewExecutable::initPager

public ViewExecutable::initPager()

Initializes the pager.

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

File

core/modules/views/src/ViewExecutable.php, line 914

Class

ViewExecutable
Represents a view as a whole.

Namespace

Drupal\views

Code

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

    if ($this->pager->usePager()) {
      $this->pager->setCurrentPage($this->current_page);
    }

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

    if (isset($this->offset)) {
      $this->pager->setOffset($this->offset);
    }
  }
}
doc_Drupal
2016-10-29 09:54:24
Comments
Leave a Comment

Please login to continue.