function PagersCacheContext::getContext
Returns the string representation of the cache context.
A cache context service's name is used as a token (placeholder) cache key, and is then replaced with the string returned by this method.
Parameters
string|null $parameter: The parameter, or NULL to indicate all possible parameter values.
Return value
string The string representation of the cache context. When $parameter is NULL, a value representing all possible parameters must be generated.
Overrides CalculatedCacheContextInterface::getContext
See also
\Drupal\Core\Pager\PagerParametersInterface::findPage()
File
- 
              core/
lib/ Drupal/ Core/ Cache/ Context/ PagersCacheContext.php, line 46  
Class
- PagersCacheContext
 - Defines a cache context for "per page in a pager" caching.
 
Namespace
Drupal\Core\Cache\ContextCode
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->pagerParams
      ->getPagerParameter();
  }
  return $pager_id . '.' . $this->pagerParams
    ->findPage($pager_id);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.