Что получается у меня на макросах.
{# collapse.html.twig #}
{% macro tablist(cards, id) %}
<div class="card-collapse" id="{{ id }}" role="tablist" aria-multiselectable="true">
{% for card in cards %}
{{ card }}
{% endfor %}
</div>
{% endmacro %}
{% macro card(title, extended, parent, target, body) %}
<div class="card{% if extended %} extended{% endif %}">
<div class="card-header card-header-collapsed">
<a
class="collapsed"
data-toggle="collapse"
data-parent="#{{ parent }}"
href="#{{ target }}"
aria-expanded="{% if extended %}true{% else %}false{% endif %}"
aria-controls="collapseTree"
>
{{ title }}
<span class=" pull-xs-right">
<i class="zmdi zmdi-chevron-down zmdi-hc-fw check"></i>
<i class="zmdi zmdi-chevron-up zmdi-hc-fw uncheck"></i>
</span>
</a>
</div>
<div class="collapse{% if extended %} in fade{% endif %} hasAccordion" id="{{ target }}" role="tabpanel">
{{ body }}
</div>
</div>
{% endmacro %}
{# game.html.twig #}
{% macro form(form) %}
<div class="card-block">
{{ form_row(form) }}
</div>
<div class="card-block clearfix">
<button type="submit" class="btn btn-link card-link pull-xs-right">Применить</button>
</div>
{% endmacro %}
{% macro login() %}
<div class="card-block bg-warning">
Для того чтобы сохранять свои результаты в игре, войдите в систему или зарегистрируйтесь!
</div>
<div class="card-footer">
<button class="btn btn-link m-y-0 p-a-0 card-link" data-toggle="modal" data-target="#drawer-log-in">Войти</button>
<button class="btn btn-link m-y-0 p-a-0 card-link" data-toggle="modal" data-target="#drawer-log-in">Регистрация</button>
</div>
{% endmacro %}
{# вывод блока collapse #}
{% import _self as body %}
{% import '::collapse.html.twig' as collapse %}
{{ collapse.tablist([
collapse.card(
'Группа',
form.groups.vars.value is not empty,
'accordion',
'collapseJanr',
body.form(form.groups)
),
collapse.card(
'Фильтр по названию',
form.query.vars.value is not empty,
'accordion',
'filterByName',
body.form(form.query)
),
collapse.card(
'Тип игры',
form.content_types.vars.value is not empty,
'accordion',
'collapseTwo',
body.form(form.content_types)
),
collapse.card(
'Возраст',
form.age_ratings.vars.value is not empty,
'accordion',
'collapseOne',
body.form(form.age_ratings)
),
collapse.card(
'Совет',
true,
'accordion',
'collapseHelp',
body.login()
),
], 'accordion') }}