function PagerTestController::showPagerCacheContext

Render API callback: Shows the pager cache context for type pager.

This function is assigned as a #pre_render callback.

File

core/modules/system/tests/modules/pager_test/src/Controller/PagerTestController.php, line 156

Class

PagerTestController
Controller routine for testing the pager.

Namespace

Drupal\pager_test\Controller

Code

public static function showPagerCacheContext(array $pager) {
  \Drupal::messenger()->addStatus(\Drupal::service('cache_contexts_manager')->convertTokensToKeys([
    'url.query_args.pagers:' . $pager['#element'],
  ])
    ->getKeys()[0]);
  return $pager;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.