Reorganize array in twig
First a FYI though, this is not something you should be doing in the template, cause the code is pretty messy. Anyway here is how you merge/group arrays in twig: {% set output = [] %} {% for item in items %} {% if not attribute(output, item.object.category) is defined %} {% set output = output|merge({ … Read more