function ViewExecutable::setCurrentPage
Same name in other branches
- 9 core/modules/views/src/ViewExecutable.php \Drupal\views\ViewExecutable::setCurrentPage()
- 8.9.x core/modules/views/src/ViewExecutable.php \Drupal\views\ViewExecutable::setCurrentPage()
- 11.x core/modules/views/src/ViewExecutable.php \Drupal\views\ViewExecutable::setCurrentPage()
Sets the current page for the pager.
Parameters
int $page: The current page.
1 call to ViewExecutable::setCurrentPage()
- ViewExecutable::__wakeup in core/
modules/ views/ src/ ViewExecutable.php - Magic method implementation to unserialize the view executable.
File
-
core/
modules/ views/ src/ ViewExecutable.php, line 575
Class
- ViewExecutable
- Represents a view as a whole.
Namespace
Drupal\viewsCode
public function setCurrentPage($page) {
$this->current_page = $page;
// Calls like ::unserialize() might call this method without a proper $page.
// Also check whether the element is pre rendered. At that point, the cache
// keys cannot longer be manipulated.
if ($page !== NULL && empty($this->element['#pre_rendered'])) {
$this->element['#cache']['keys'][] = 'page:' . $page;
}
// If the pager is already initialized, pass it through to the pager.
if (!empty($this->pager)) {
return $this->pager
->setCurrentPage($page);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.