You are here

views-mini-pager.html.twig in Drupal 10

Theme override for a views mini-pager.

Available variables:

  • heading_id: Pagination heading ID.
  • items: List of pager items.

File

core/themes/claro/templates/views/views-mini-pager.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Theme override for a views mini-pager.
  5. *
  6. * Available variables:
  7. * - heading_id: Pagination heading ID.
  8. * - items: List of pager items.
  9. *
  10. * @see template_preprocess_views_mini_pager()
  11. */
  12. #}
  13. {%
  14. set pager_action_classes = [
  15. 'pager__link',
  16. 'pager__link--mini',
  17. 'pager__link--action-link'
  18. ]
  19. %}
  20. {% if items.previous or items.next %}
  21. <nav{{ attributes.addClass('pager').setAttribute('role', 'navigation').setAttribute('aria-labelledby', heading_id) }}>
  22. <h4{{ title_attributes.addClass('visually-hidden').setAttribute('id', heading_id) }}>{{ 'Pagination'|t }}</h4>
  23. <ul{{ content_attributes.addClass('pager__items', 'js-pager__items') }}>
  24. {% if items.previous %}
  25. {% apply spaceless %}
  26. <li class="pager__item pager__item--mini pager__item--action pager__item--previous">
  27. <a{{ items.previous.attributes.addClass(pager_action_classes).setAttribute('title', 'Go to previous page'|t).setAttribute('href', items.previous.href) }}>
  28. <span class="visually-hidden">{{ 'Previous page'|t }}</span>
  29. </a>
  30. </li>
  31. {% endapply %}
  32. {% endif %}
  33. {% if items.current %}
  34. <li class="pager__item pager__item--mini pager__item--current">
  35. <span class="visually-hidden">
  36. {{ 'Current page'|t }}
  37. </span>
  38. {{ items.current }}
  39. </li>
  40. {% endif %}
  41. {% if items.next %}
  42. {% apply spaceless %}
  43. <li class="pager__item pager__item--mini pager__item--action pager__item--next">
  44. <a{{ items.next.attributes.addClass(pager_action_classes).setAttribute('title', 'Go to next page'|t).setAttribute('href', items.next.href) }}>
  45. <span class="visually-hidden">{{ 'Next page'|t }}</span>
  46. </a>
  47. </li>
  48. {% endapply %}
  49. {% endif %}
  50. </ul>
  51. </nav>
  52. {% endif %}