Same filename and directory in other branches
- 8.9.x core/lib/Drupal/Core/Cache/Context/PagersCacheContext.php
- 9 core/lib/Drupal/Core/Cache/Context/PagersCacheContext.php
Namespace
Drupal\Core\Cache\Context
File
core/lib/Drupal/Core/Cache/Context/PagersCacheContext.php
View source
<?php
namespace Drupal\Core\Cache\Context;
use Drupal\Core\Cache\CacheableMetadata;
use Drupal\Core\Pager\PagerParametersInterface;
class PagersCacheContext implements CalculatedCacheContextInterface {
protected $pagerParams;
public function __construct(PagerParametersInterface $pager_params) {
$this->pagerParams = $pager_params;
}
public static function getLabel() {
return t('Pager');
}
public function getContext($pager_id = NULL) {
if ($pager_id === NULL) {
return $this->pagerParams
->getPagerParameter();
}
return $pager_id . '.' . $this->pagerParams
->findPage($pager_id);
}
public function getCacheableMetadata($pager_id = NULL) {
return new CacheableMetadata();
}
}
Classes