views-bootstrap-carousel.html.twig in Views Bootstrap 8.3
Same filename and directory in other branches
Default theme implementation for displaying a view as a bootstrap carousel.
Available variables:
- view: The view object.
- rows: A list of the view's row items.
- id: A valid HTML ID and guaranteed to be unique.
- interval: The amount of time to delay between automatically cycling a slide item. If false, carousel will not automatically cycle.
- pause: Pauses the cycling of the carousel on mouseenter and resumes the cycling of the carousel on mouseleave.
- wrap: Whether the carousel should cycle continuously or have hard stops.
See also
File
templates/views-bootstrap-carousel.html.twigView source
- {#
- /**
- * @file
- * Default theme implementation for displaying a view as a bootstrap carousel.
- *
- * Available variables:
- * - view: The view object.
- * - rows: A list of the view's row items.
- * - id: A valid HTML ID and guaranteed to be unique.
- * - interval: The amount of time to delay between automatically cycling a
- * slide item. If false, carousel will not automatically cycle.
- * - pause: Pauses the cycling of the carousel on mouseenter and
- * resumes the cycling of the carousel on mouseleave.
- * - wrap: Whether the carousel should cycle continuously or have
- * hard stops.
- *
- * @see template_preprocess_views_bootstrap_carousel()
- *
- * @ingroup themeable
- */
- #}
- {{ attach_library('views_bootstrap/components') }}
-
- <div id="{{ id }}" class="carousel slide" data-ride="carousel" data-interval="{{ interval }}" data-pause="{{ pause }}" data-wrap="{{ wrap }}">
-
- {# Carousel indicators #}
- {% if indicators %}
- <ol class="carousel-indicators">
- {% for key, row in rows %}
- {% set indicator_classes = [loop.first ? 'active'] %}
- <li class="{{ indicator_classes|join(' ') }}" data-target="#{{ id }}" data-slide-to="{{ key }}"></li>
- {% endfor %}
- </ol>
- {% endif %}
-
- {# Carousel rows #}
- <div class="carousel-inner" role="listbox">
- {% for row in rows %}
- {% set row_classes = ['item', loop.first ? 'active'] %}
- <div {{ row.attributes.addClass(row_classes) }}>
- {% if display == 'fields' %}
- {{ row.image }}
- {% if row.title or row.description %}
- <div class="carousel-caption">
- {% if row.title %}
- <h3>{{ row.title }}</h3>
- {% endif %}
- {% if row.description %}
- <p>{{ row.description }}</p>
- {% endif %}
- </div>
- {% endif %}
- {% else %}
- {{ row.content }}
- {% endif %}
- </div>
- {% endfor %}
- </div>
-
- {# Carousel navigation #}
- {% if navigation %}
- <a class="left carousel-control" href="#{{ id }}" role="button" data-slide="prev">
- <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
- <span class="sr-only">{{ 'Previous'|t }}</span>
- </a>
- <a class="right carousel-control" href="#{{ id }}" role="button" data-slide="next">
- <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
- <span class="sr-only">{{ 'Next'|t }}</span>
- </a>
- {% endif %}
- </div>