Skip to content

Instantly share code, notes, and snippets.

@vasilukwolf
vasilukwolf / list.html.twig
Created September 7, 2017 15:57 — forked from tentacode/list.html.twig
Twig recursive macro
{% macro recursiveCategory(category) %}
<li>
<h4><a href="{{ path(category.route, category.routeParams) }}">{{ category }}</a></h4>
{% if category.children|length %}
<ul>
{% for child in category.children %}
{{ _self.recursiveCategory(child) }}
{% endfor %}
</ul>