function template_preprocess_entity_pager in Entity Pager 2.0.x
Same name and namespace in other branches
- 8 entity_pager.module \template_preprocess_entity_pager()
- 7 entity_pager.module \template_preprocess_entity_pager()
Prepares variables for entity pager templates.
Default template: entity-pager.html.twig.
Parameters
array $variables: An associative array containing:
- view: The view of the entity pager.
File
- ./
entity_pager.module, line 42 - Provides Next and Previous navigation on entities.
Code
function template_preprocess_entity_pager(array &$variables) {
/** @var \Drupal\entity_pager\EntityPagerInterface $entity_pager */
$entity_pager = \Drupal::service('entity_pager.factory')
->get($variables['view']);
$variables['links'] = $entity_pager
->getLinks();
$variables['count_word'] = $entity_pager
->getCountWord();
$variables['#attached']['library'][] = 'entity_pager/entity-pager';
$variables['#cache']['contexts'][] = 'url.path';
}