function view::init_pager

Same name in other branches
  1. 7.x-3.x 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

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