Unable to use Carousel pattern on a View with Fields.

Created on 14 December 2023, 11 months ago
Updated 15 January 2024, 10 months ago

Problem/Motivation

I would like to add a dynamic Carousel using my existing content (The nodes have a Title and Image field).
However the fields are not rendered correctly and all images are shown at once.

In the carousel pattern:

<div class="carousel-inner">
    {% for slide in slides %}
      {% if loop.first %}
        {{ slide|add_class('carousel-item', 'active') }}
      {% else %}
        {{ slide|add_class('carousel-item') }}
      {% endif %}
    {% endfor %}
  </div>

The add_class does not work in the 2nd case.
(Credit to Florent Torregrosa for helping track this down!).

Steps to reproduce

1. Create a View of Content and select "Pattern" as the View Format, and "Carousel" as the pattern, mapping the "row" to "slides" parameter.
2. Select "Pattern" for the Row style and under Settings select "(Carousel item)" then map the Image field to "Image" and Title field to "Caption".

Proposed resolution

Ensure that the pattern in question adds the correct classes to the div elements when Views Fields are used.

Feature request
Status

Closed: won't fix

Version

2.0

Component

Code

Created by

🇬🇧United Kingdom entropea

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024