class PagersCacheContext in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/Cache/Context/PagersCacheContext.php \Drupal\Core\Cache\Context\PagersCacheContext
Defines a cache context for "per page in a pager" caching.
Cache context ID: 'url.query_args.pagers' (to vary by all pagers). Calculated cache context ID: 'url.query_args.pagers:%pager_id', e.g. 'url.query_args.pagers:1' (to vary by the pager with ID 1).
Hierarchy
- class \Drupal\Core\Cache\Context\RequestStackCacheContextBase
- class \Drupal\Core\Cache\Context\PagersCacheContext implements CalculatedCacheContextInterface
Expanded class hierarchy of PagersCacheContext
1 string reference to 'PagersCacheContext'
- core.services.yml in core/
core.services.yml - core/core.services.yml
1 service uses PagersCacheContext
File
- core/
lib/ Drupal/ Core/ Cache/ Context/ PagersCacheContext.php, line 19 - Contains \Drupal\Core\Cache\Context\PagersCacheContext.
Namespace
Drupal\Core\Cache\ContextView source
class PagersCacheContext extends RequestStackCacheContextBase implements CalculatedCacheContextInterface {
/**
* {@inheritdoc}
*/
public static function getLabel() {
return t('Pager');
}
/**
* {@inheritdoc}
*
* @see pager_find_page()
*/
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);
}
/**
* {@inheritdoc}
*/
public function getCacheableMetadata($pager_id = NULL) {
return new CacheableMetadata();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PagersCacheContext:: |
public | function |
Gets the cacheability metadata for the context based on the parameter value. Overrides CalculatedCacheContextInterface:: |
|
PagersCacheContext:: |
public | function |
Overrides CalculatedCacheContextInterface:: |
|
PagersCacheContext:: |
public static | function |
Returns the label of the cache context. Overrides CalculatedCacheContextInterface:: |
|
RequestStackCacheContextBase:: |
protected | property | The request stack. | |
RequestStackCacheContextBase:: |
public | function | Constructs a new RequestStackCacheContextBase class. |