Skip to content

Instantly share code, notes, and snippets.

View christopherhealey's full-sized avatar

Christopher Healey christopherhealey

View GitHub Profile
@garak
garak / list.html.twig
Last active July 18, 2020 05:50 — forked from tentacode/list.html.twig
Twig recursive macro
{% macro recursiveCategory(category) %}
{% import _self as self %}
<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 %}