I'm trying to structure the output of a view into specific HTML for a carousel/slider I'm generating, basically I'm trying to turn a regular list of X people into groups, which I'm then dividing further for the purposes of structuring the HTML as I need
currently my rows variable contains X items (likely between 50-100)
- I am trying to split that into
pages of 12 items
- Each page has 4
rows and 3 columns
So I want the HTML to look like this
<div class="page">
<div class="row">
<div class="col">A</div>
<div class="col">A</div>
<div class="col">A</div>
</div>
<div class="row">
<div class="col">A</div>
<div class="col">A</div>
<div class="col">A</div>
</div>
...
</div>
...
And my current twig is setup like this
{% set blank = [] %}
<div id="people-carousel-wrapper">
<div id="people-carousel-container">
{% for page in rows|batch(12) %}
<div class="people-page">
<div class="container">
{% for row in page|batch(4, blank) %}
<div class="row">
{% for people in row|batch(3, blank) %}
<div class="people-column col">
{{- people.content -}}
</div>
{% endfor %}
</div>
{% endfor %}
</div>
</div>
{% endfor %}
</div>
</div>
What I'd like to do is have it render out the full list of 12 items per page, regardless of if the number of items divides nicely by 12, except I don't seem to be able to make it render out the remaining HTML items, the twig batch page seems to suggest that you just need to fill in the second parameter for the batch function and it will use that item if nothing is there, at the moment it just stops when there are no more items