Provides a {% switch %} tag for Twig switch case statements.
Provides a {% includeDir %} tag for Twig
Provides a {% useDir %} tag for Twig
{% switch myVar %}
{% case 'value1' %}
{# ...code here to run for value1 #}
{% case 'value2' %}
{# ...code here to run for value2 #}
{% default %}
{# ...code here to run for default when no case matched #}
{% endswitch %}
{% includeDir '/popups' %}
The files in the directory will be included alphabetically.
To include all files within a given directory recursive simply add the keyword recursive to your include statement:
<div class="modal-container">
{% includeDir '/popups' recursive %}
</div>
Now also the popups from the directories /popups/user and /popups/system etc. will be included.
Caution: The templates will be included alphabetically as well, including the directories. Thus the template /popups/footer.twig will be included before the templates from the directory /popups/system followed by /popups/user followed by a possible /popups/zebraHeader.twig. It is recommended to use includeDir only for templates which do not require a specific order.
As known from the Twig Core include you can control the available variables with the keywords with and only (compare: include)
<div class="modal-container">
{# only the foo variable will be accessible #}
{% includeDir '/modals' recursive with {'foo': 'bar'} only %}
</div>
{% useDir '/form/specials' %}
The files in the directory will be included alphabetically.
To use all files within a given directory recursive simply add the keyword recursive to your use statement:
{% useDir '/form/specials' recursive %}
Now also the popups from the directories /form/specials and /form/field etc. will be used.
Caution: The templates will be used alphabetically as well, including the directories. Thus the template /form/field/select.twig will be included before the templates from the directory form/specials. It is recommended to use useDir only for templates which do not require a specific order.