You are here

amp-views-carousel.html.twig in Accelerated Mobile Pages (AMP) 8.3

Default theme implementation for a view template to display a list of rows.

Available variables:

  • attributes: HTML attributes for the container.
  • rows: A list of rows for this list.
    • attributes: The row's HTML attributes.
    • content: The row's contents.
  • title: The title of this group of rows. May be empty.
  • carousel:
    • attributes: HTML attributes for the carousel element.

File

templates/amp-views-carousel.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation for a view template to display a list of rows.
  5. *
  6. * Available variables:
  7. * - attributes: HTML attributes for the container.
  8. * - rows: A list of rows for this list.
  9. * - attributes: The row's HTML attributes.
  10. * - content: The row's contents.
  11. * - title: The title of this group of rows. May be empty.
  12. * - carousel:
  13. * - attributes: HTML attributes for the carousel element.
  14. *
  15. * @see template_preprocess_amp_views_carousel()
  16. *
  17. * @ingroup themeable
  18. */
  19. #}
  20. {% if attributes -%}
  21. <div{{ attributes }}>
  22. {% endif %}
  23. {% if title %}
  24. <h3>{{ title }}</h3>
  25. {% endif %}
  26. <amp-carousel{{ carousel.attributes|without('autoplay', 'controls', 'loop') }}{% if carousel.attributes.controls %} controls{% endif %}{% if carousel.attributes.autoplay %} autoplay{% endif %}{% if carousel.attributes.loop %} loop{% endif %}>
  27. {% for row in rows %}
  28. {{ row.content }}
  29. {% endfor %}
  30. </amp-carousel>
  31. {% if attributes -%}
  32. </div>
  33. {% endif %}