You are here

public function PagersCacheContext::getContext in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Cache/Context/PagersCacheContext.php \Drupal\Core\Cache\Context\PagersCacheContext::getContext()

Overrides CalculatedCacheContextInterface::getContext

See also

pager_find_page()

File

core/lib/Drupal/Core/Cache/Context/PagersCacheContext.php, line 33
Contains \Drupal\Core\Cache\Context\PagersCacheContext.

Class

PagersCacheContext
Defines a cache context for "per page in a pager" caching.

Namespace

Drupal\Core\Cache\Context

Code

public function getContext($pager_id = NULL) {

  // The value of the 'page' query argument contains the information that
  // controls *all* pagers.
  if ($pager_id === NULL) {
    return $this->requestStack
      ->getCurrentRequest()->query
      ->get('page', '');
  }
  return $pager_id . '.' . pager_find_page($pager_id);
}