function ViewExecutable::setItemsPerPage
Same name in other branches
- 9 core/modules/views/src/ViewExecutable.php \Drupal\views\ViewExecutable::setItemsPerPage()
- 8.9.x core/modules/views/src/ViewExecutable.php \Drupal\views\ViewExecutable::setItemsPerPage()
- 10 core/modules/views/src/ViewExecutable.php \Drupal\views\ViewExecutable::setItemsPerPage()
Sets the items per page on the pager.
Parameters
int $items_per_page: The items per page.
File
-
core/
modules/ views/ src/ ViewExecutable.php, line 630
Class
- ViewExecutable
- Represents a view as a whole.
Namespace
Drupal\viewsCode
public function setItemsPerPage($items_per_page) {
// Check whether the element is pre rendered. At that point, the cache keys
// cannot longer be manipulated.
if (empty($this->element['#pre_rendered'])) {
$this->element['#cache']['keys'][] = 'items_per_page:' . $items_per_page;
}
$this->items_per_page = $items_per_page;
// If the pager is already initialized, pass it through to the pager.
if (!empty($this->pager)) {
$this->pager
->setItemsPerPage($items_per_page);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.