Seems like the argument is not passed properly ...
{% set items = {
item: {
'id': '1',
'brand': 'client1',
'description': 'solutions.client1.description' | trans},
item: {
'id': '2',
'brand': 'client2',
'description': 'solutions.client2.description' | trans}
} %}
{% include 'site/case-excerpt.html.twig'
with {'id': items.item.id,
'brand': items.item.brand,
'description': items.item.description
}
%}
Then in the site/case-excerpt.html.twig
file :
{% include 'site/testimonials/item.html.twig'
with {'id': id,
'brand': brand,
'description': description
}
%}
And in the site/testimonials/item.html.twig
file:
<div class="carousel-item {{ id }}">
<img src="images/brands/{{ brand }}.jpg">
<p>
{{ description }}
</p>
</div>
The expected output would be the following :
<div class="carousel-item 1">
<img src="images/brands/client1.jpg">
<p>
I'm the content of the translation for the first client
</p>
</div>
<div class="carousel-item 2">
<img src="images/brands/client2.jpg">
<p>
I'm the content of the translation for the second client
</p>
</div>
I dropped the idea of looping manually trough items
since it seems to be possible to have it done nicely, here for example.