Deeply Nested Menu Loop with Twig using Timber
Using TimberMenu() and I have a menu for mobile that needs to go pretty deep. There must be a better way to write this with twig. Using macros and/or loop.parent or loop.index?
It's basically this loop with one nested loop but I need to go all the way down to a great great grandchild.
ul class="menu primary dropdown float-right" aria-hidden="true" data-dropdown-menu data-hover-delay="0" data-closing-time="0"
{% for item in primary_menu.get_items %}
li class="{{ item.class }}"
a href="{{ item.link }}"{{ item.title }}/a
{% if item.get_children %}
ul class="menu"
{% for child in item.get_children %}
li class="{{ child.class }}"a href="{{ child.link }}"{{ child.title }}/a/li
{% endfor %}
/ul
{% endif %}
/li
{% endfor %}
/ul