You are here

public function Pager::__construct in Drupal 8

Same name and namespace in other branches
  1. 9 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\Pager

Code

public function __construct($totalItems, $limit, $currentPage = 0) {
  $this->totalItems = $totalItems;
  $this->limit = $limit;
  $this
    ->setTotalPages($totalItems, $limit);
  $this
    ->setCurrentPage($currentPage);
}