function Pager::__construct

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Pager/Pager.php \Drupal\Core\Pager\Pager::__construct()
  2. 8.9.x core/lib/Drupal/Core/Pager/Pager.php \Drupal\Core\Pager\Pager::__construct()
  3. 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\Pager

Code

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.