public function Pager::__construct in Drupal 9
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Pager/Pager.php \Drupal\Core\Pager\Pager::__construct()
- 10 core/lib/Drupal/Core/Pager/Pager.php \Drupal\Core\Pager\Pager::__construct()
Pager constructor.
Parameters
int $totalItems: The total number of items.
int $limit: The maximum number of items per page.
int $currentPage: The current page.
File
- core/
lib/ Drupal/ Core/ Pager/ Pager.php, line 48
Class
- Pager
- A value object that represents a pager.
Namespace
Drupal\Core\PagerCode
public function __construct($totalItems, $limit, $currentPage = 0) {
$this->totalItems = $totalItems;
$this->limit = $limit;
$this
->setTotalPages($totalItems, $limit);
$this
->setCurrentPage($currentPage);
}