You are here

public function PagersCacheContext::__construct in Drupal 8

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

Constructs a new PagersCacheContext object.

Parameters

\Drupal\Core\Pager\PagerParametersInterface $pager_params: The pager parameters.

File

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

Class

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

Namespace

Drupal\Core\Cache\Context

Code

public function __construct($pager_params) {
  if (!$pager_params instanceof PagerParametersInterface) {
    @trigger_error('Calling ' . __METHOD__ . ' with a $pager_params argument that does not implement \\Drupal\\Core\\Pager\\PagerParametersInterface is deprecated in drupal:8.8.0 and is required in drupal:9.0.0. See https://www.drupal.org/node/2779457', E_USER_DEPRECATED);
    $pager_params = \Drupal::service('pager.parameters');
  }
  $this->pagerParams = $pager_params;
}