class PagererCache in Pagerer 8.2
Same name and namespace in other branches
- 8 src/PagererCache.php \Drupal\pagerer\PagererCache
Pagerer cache callback.
Hierarchy
- class \Drupal\pagerer\PagererCache implements TrustedCallbackInterface
Expanded class hierarchy of PagererCache
File
- src/
PagererCache.php, line 11
Namespace
Drupal\pagererView source
class PagererCache implements TrustedCallbackInterface {
/**
* {@inheritdoc}
*/
public static function trustedCallbacks() {
return [
'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.
*
* @param array $pager
* A renderable array of #type => pager.
*
* @return array
* The altered renderable array.
*/
public static function preRenderPager(array $pager) {
CacheableMetadata::createFromRenderArray($pager)
->merge(CacheableMetadata::createFromObject(\Drupal::config('pagerer.settings')))
->applyTo($pager);
return $pager;
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PagererCache:: |
public static | function | A #pre_render callback for type #pager. | |
PagererCache:: |
public static | function |
Lists the trusted callbacks provided by the implementing class. Overrides TrustedCallbackInterface:: |
|
TrustedCallbackInterface:: |
constant | Untrusted callbacks throw exceptions. | ||
TrustedCallbackInterface:: |
constant | Untrusted callbacks trigger silenced E_USER_DEPRECATION errors. | ||
TrustedCallbackInterface:: |
constant | Untrusted callbacks trigger E_USER_WARNING errors. |