You are here

function view::init_pager in Views (for Drupal 7) 6.3

Same name and namespace in other branches
  1. 7.3 includes/view.inc \view::init_pager()

Initialize the pager

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

File

includes/view.inc, line 529
view.inc Provides the view object type and associated methods.

Class

view
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.

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