function Pager::setTotalPages

Same name in other branches
  1. 9 core/lib/Drupal/Core/Pager/Pager.php \Drupal\Core\Pager\Pager::setTotalPages()
  2. 8.9.x core/lib/Drupal/Core/Pager/Pager.php \Drupal\Core\Pager\Pager::setTotalPages()
  3. 10 core/lib/Drupal/Core/Pager/Pager.php \Drupal\Core\Pager\Pager::setTotalPages()

Sets the total number of pages.

Parameters

int $totalItems: The total number of items.

int $limit: The maximum number of items per page.

1 call to Pager::setTotalPages()
Pager::__construct in core/lib/Drupal/Core/Pager/Pager.php
Pager constructor.

File

core/lib/Drupal/Core/Pager/Pager.php, line 77

Class

Pager
A value object that represents a pager.

Namespace

Drupal\Core\Pager

Code

protected function setTotalPages($totalItems, $limit) {
    $this->totalPages = (int) ceil($totalItems / $limit);
}

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