You are here

public static function PagererCache::preRenderPager in Pagerer 8

Same name and namespace in other branches
  1. 8.2 src/PagererCache.php \Drupal\pagerer\PagererCache::preRenderPager()

A #pre_render callback for type #pager.

Used to associate the config:pagerer.settings cache tag to the #pager type, since Pagerer makes the rendered pager dependent on its configuration.

Parameters

array $pager: A renderable array of #type => pager.

Return value

array The altered renderable array.

File

src/PagererCache.php, line 25

Class

PagererCache
Cache related helpers.

Namespace

Drupal\pagerer

Code

public static function preRenderPager(array $pager) {
  CacheableMetadata::createFromRenderArray($pager)
    ->merge(CacheableMetadata::createFromObject(\Drupal::config('pagerer.settings')))
    ->applyTo($pager);
  return $pager;
}