protected function Pager::setCurrentPage in Drupal 8
Same name and namespace in other branches
- 9 core/lib/Drupal/Core/Pager/Pager.php \Drupal\Core\Pager\Pager::setCurrentPage()
- 10 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));
}