<aside>
{% if app.request.attributes.get('structure').document.extensionsData.offsetGet('excerpt').categories|length > 0 %}
{% set theme = app.request.attributes.get('structure').document.extensionsData.offsetGet('excerpt').categories[0] %}
{% endif %}
{% set orderMap = {
'agenda': 1,
'articles': 2,
'experience': 3,
'analyses': 4,
'guides': 5,
'annuaire': 6,
} %}
{% set sortedItems = [] %}
{% for item in sulu_navigation_root_tree('aside', 3) %}
{% for child in item.children %}
{% set iconPath = '' %}
{% set tmpUrl = sulu_content_path(child.url) %}
{% if "articles" in child.url %}
{% set iconPath = 'svg/articles-icon.html.twig' %}
{% elseif "analyses" in child.url %}
{% set iconPath = 'svg/analyse-icon.html.twig' %}
{% elseif "annuaire" in child.url %}
{% set iconPath = 'svg/annuaires-icon.html.twig' %}
{% elseif "experience" in child.url %}
{% set iconPath = 'svg/exp-demarches-icon.html.twig' %}
{% elseif "guides" in child.url %}
{% set iconPath = 'svg/guides-outils-icon.html.twig' %}
{% elseif "agenda" in child.url %}
{% set iconPath = 'svg/agenda-icon.html.twig' %}
{% endif %}
{% if theme is defined and theme is not empty %}
{% set url = tmpUrl ~ "?theme=" ~ theme ~ "&themeName=" ~ app.request.attributes.get('structure').document.title|url_encode %}
{% set order = 999 %}
{% set found = false %}
{% for term in orderMap|keys %}
{% if term in child.url %}
{% set order = orderMap[term] %}
{% set found = true %}
{% endif %}
{% endfor %}
{% if found %}
{% set sortedItems = sortedItems|merge([{
'title': child.title,
'url': url,
'iconPath': iconPath,
'order': order,
}]) %}
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
{% set sortedItems = sortedItems|sort((a, b) => a.order - b.order) %}
{% for item in sortedItems %}
<a href="{{ item.url }}" class="mb-20px aside-menu-elem cwhite nodeco fs24 fw400 lh32 dflex aic br8 shadow-standard">{{ source(item.iconPath) }}<span class="ml-1em">{{ item.title }}</span></a>
{% endfor %}
{% include "blocks/aside/referents-pqna.html.twig" %}
</aside>