PagersCacheContext::getContext

public PagersCacheContext::getContext($pager_id = NULL)

Overrides CalculatedCacheContextInterface::getContext

See also

pager_find_page()

File

core/lib/Drupal/Core/Cache/Context/PagersCacheContext.php, line 28

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);
}
doc_Drupal
2016-10-29 09:32:58
Comments
Leave a Comment

Please login to continue.