file item-list--bootstrap-carousel-indicators.html.twig

Theme override for an item list.

Available variables:

  • attributes: HTML attributes to be applied to the list.
  • items: A list of items. Each item contains:
    • attributes: HTML attributes to be applied to each list item.
  • list_type: The tag for list element ("ul" or "ol").
  • start_index: (optional) Alters the slide position relative to its current position.
  • target: A valid HTML ID for the carousel container.

See Also

  • template_preprocess_item_list()
1 theme call to item-list--bootstrap-carousel-indicators.html.twig
BootstrapCarousel::preprocessVariables in src/Plugin/Preprocess/BootstrapCarousel.php
Preprocess the variables array.
Source
  1. {#
  2. /**
  3. * @file
  4. * Theme override for an item list.
  5. *
  6. * Available variables:
  7. * - attributes: HTML attributes to be applied to the list.
  8. * - items: A list of items. Each item contains:
  9. * - attributes: HTML attributes to be applied to each list item.
  10. * - list_type: The tag for list element ("ul" or "ol").
  11. * - start_index: (optional) Alters the slide position relative to its current
  12. * position.
  13. * - target: A valid HTML ID for the carousel container.
  14. *
  15. * @ingroup templates
  16. *
  17. * @see template_preprocess_item_list()
  18. */
  19. #}
  20. {% set classes = ['carousel-indicators'] %}
  21. {% if items %}
  22. <{{ list_type }}{{ attributes.addClass(classes) }} role="menu">
  23. {% for item in items %}
  24. {% set item_classes = [start_index == loop.index0 ? 'active'] %}
  25. <li{{ item.attributes.addClass(item_classes) }} data-target="{{ target }}" data-slide-to="{{ loop.index0 }}"></li>
  26. {% endfor %}
  27. </{{ list_type }}>
  28. {% endif %}

Related topics