Last active
December 3, 2018 19:40
-
-
Save MaximStrutinskiy/04db10aa092041cfe38479a2ca3d6606 to your computer and use it in GitHub Desktop.
Twig macro - [time ~ 2.8s]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% import _self as recursive_category_macro %} | |
{% macro recursive_category(category, recursive_category_macro) %} | |
<li> | |
<h4>{{ category.nameRu }}</h4> | |
{% if category.SChildren|length %} | |
<ul> | |
{% for child in category.SChildren %} | |
{{ recursive_category_macro.recursive_category(child, recursive_category_macro) }} | |
{% endfor %} | |
</ul> | |
{% endif %} | |
</li> | |
{% endmacro %} | |
{% if categories %} | |
<div id="categories"> | |
<ul> | |
{% for category in categories %} | |
{{ recursive_category_macro.recursive_category(category, recursive_category_macro) }} | |
{% endfor %} | |
</ul> | |
</div> | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment