function PagerManager::getUpdatedParameters
Same name in other branches
- 8.9.x core/lib/Drupal/Core/Pager/PagerManager.php \Drupal\Core\Pager\PagerManager::getUpdatedParameters()
- 10 core/lib/Drupal/Core/Pager/PagerManager.php \Drupal\Core\Pager\PagerManager::getUpdatedParameters()
- 11.x core/lib/Drupal/Core/Pager/PagerManager.php \Drupal\Core\Pager\PagerManager::getUpdatedParameters()
Overrides PagerManagerInterface::getUpdatedParameters
File
-
core/
lib/ Drupal/ Core/ Pager/ PagerManager.php, line 79
Class
- PagerManager
- Provides a manager for pagers.
Namespace
Drupal\Core\PagerCode
public function getUpdatedParameters(array $query, $element, $index) {
// Build the 'page' query parameter. This is built based on the current
// page of each pager element (or NULL if the pager is not set), with the
// exception of the requested page index for the current element.
$element_pages = [];
$max = $this->getMaxPagerElementId();
for ($i = 0; $i <= $max; $i++) {
$currentPage = ($pager = $this->getPager($i)) ? $pager->getCurrentPage() : NULL;
$element_pages[] = $i == $element ? $index : $currentPage;
}
$query['page'] = implode(',', $element_pages);
// Merge the query parameters passed to this function with the parameters
// from the current request. In case of collision, the parameters passed
// into this function take precedence.
if ($current_query = $this->pagerParams
->getQueryParameters()) {
$query = array_merge($current_query, $query);
}
return $query;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.