function Pager::setCurrentPage
Same name in other branches
- 9 core/lib/Drupal/Core/Pager/Pager.php \Drupal\Core\Pager\Pager::setCurrentPage()
- 8.9.x core/lib/Drupal/Core/Pager/Pager.php \Drupal\Core\Pager\Pager::setCurrentPage()
- 11.x core/lib/Drupal/Core/Pager/Pager.php \Drupal\Core\Pager\Pager::setCurrentPage()
Sets the current page to a valid value within range.
If a page that does not correspond to the actual range of the result set was provided, this function will set the closest page actually within the result set.
Parameters
int $currentPage: (optional) The current page.
1 call to Pager::setCurrentPage()
- Pager::__construct in core/
lib/ Drupal/ Core/ Pager/ Pager.php - Pager constructor.
File
-
core/
lib/ Drupal/ Core/ Pager/ Pager.php, line 65
Class
- Pager
- A value object that represents a pager.
Namespace
Drupal\Core\PagerCode
protected function setCurrentPage($currentPage = 0) {
$this->currentPage = max(0, min($currentPage, $this->getTotalPages() - 1));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.