diff --git a/core/lib/Drupal/Core/Cache/Context/PagersCacheContext.php b/core/lib/Drupal/Core/Cache/Context/PagersCacheContext.php index 74f10bb5c3..47221c654e 100644 --- a/core/lib/Drupal/Core/Cache/Context/PagersCacheContext.php +++ b/core/lib/Drupal/Core/Cache/Context/PagersCacheContext.php @@ -27,7 +27,11 @@ class PagersCacheContext implements CalculatedCacheContextInterface { * @param \Drupal\Core\Pager\PagerParametersInterface $pager_params * The pager parameters. */ - public function __construct(PagerParametersInterface $pager_params) { + public function __construct(PagerParametersInterface $pager_params = NULL) { + if (!$pager_params) { + @trigger_error('Calling ' . __METHOD__ . ' without the $pager_params argument 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; } diff --git a/core/lib/Drupal/Core/Pager/PagerManager.php b/core/lib/Drupal/Core/Pager/PagerManager.php index 0acbc885f6..eea7e5867a 100644 --- a/core/lib/Drupal/Core/Pager/PagerManager.php +++ b/core/lib/Drupal/Core/Pager/PagerManager.php @@ -110,11 +110,6 @@ protected function setPager(Pager $pager, $element = 0) { /** * Initialize global variables for backwards compatibility. - * - * @todo Pager global variables are deprecated and will be removed before - * Drupal 9.0.0. - * - * @see https://www.drupal.org/node/2779457 */ protected function initializeGlobals() { if (empty($GLOBALS['pager_page_array'])) { @@ -123,12 +118,7 @@ protected function initializeGlobals() { } /** - * Updates global variables with a pager data. - * - * @todo Pager global variables are deprecated and will be removed before - * Drupal 9.0.0. - * - * @see https://www.drupal.org/node/2779457 + * Updates global variables with a pager data for backwards compatibility. */ protected function updateGlobals() { $pager_total_items = [];