1 view.inc view::init_pager()

Initialize the pager

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

File

core/modules/views/includes/view.inc, line 722
Provides the view object type and associated methods.

Class

view

Code

function init_pager() {
  if (empty($this->query->pager)) {
    $this->query->pager = $this->display_handler->get_plugin('pager');

    if ($this->query->pager->use_pager()) {
      $this->query->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->query->pager->set_items_per_page($this->items_per_page);
    }

    if (isset($this->offset)) {
      $this->query->pager->set_offset($this->offset);
    }
  }
}