<nav class="nav-categories">
<ul class="nav-categories__list">
{% for category in categories %}
{% if category.subMenuType|length > 0 %}
<li class="nav-categories__item nav-categories__item-dropdown">
<button type="button" class="nav-categories__link nav-categories__link-dropdown">
{% if category.menuName %}
{{ category.menuName }}
{% else %}
{{ category.name }}
{% endif %}
</button>
{% set subMenu = category.subMenuType.first %}
{{ render(controller(subMenu.controllerName, {'subMenuType':subMenu.id,'category':category.id,'menuType':menuType.id})) }}
</li>
{% else %}
<li class="nav-categories__item">
<a href="{{ path('web_get_page', {slug: category.slug}) }}" class="nav-categories__link">
{% if category.menuName %}
{{ category.menuName }}
{% else %}
{{ category.name }}
{% endif %}
</a>
</li>
{% endif %}
{% endfor %}
</ul>
</nav>