function view::init_pager

Initialize the pager.

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

File

includes/view.inc, line 738

Class

view
An object to contain all of the data to generate a view.

Code

public function init_pager() {
    if (empty($this->query->pager)) {
        // If the query doesn't exist, initialize it.
        if (empty($this->query)) {
            $this->init_query();
        }
        $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);
        }
    }
}