{% extends 'knp_menu_base.html.twig' %}
{% import _self as self %}
{% macro attributes(attributes, classes) %}
{%- if classes is not empty -%}
{%- if attributes.class is defined and attributes.class is not empty -%}
{%- set classes = classes|merge([attributes.class]) -%}
{%- endif -%}
{%- set attributes = attributes|merge({'class': classes|join(' ')}) -%}
{%- endif -%}
{%- for name, value in attributes -%}
{%- if value is not none and value is not same as(false) -%}
{{- ' %s="%s"'|format(name, value is same as(true) ? name|e : value|e)|raw -}}
{%- endif -%}
{%- endfor -%}
{% endmacro %}
{% block compressed_root %}
{% apply spaceless %}
{{ block('root') }}
{% endapply %}
{% endblock %}
{% block root %}
{#<div class="kt-notification">#}
{{ block('list') -}}
{#</div>#}
{% endblock %}
{% block list %}
{% if item.hasChildren and options.depth is not same as(0) and item.displayChildren %}
{{ block('children') }}
{% endif %}
{% endblock %}
{% block children %}
{# save current variables #}
{%- set currentOptions = options -%}
{%- set currentItem = item -%}
{%- set currentSuperadmin = superadmin|default(false) -%}
{# update the depth for children #}
{%- if options.depth is not none -%}
{%- set options = options|merge({'depth': currentOptions.depth - 1}) -%}
{%- endif -%}
{# update the matchingDepth for children #}
{%- if options.matchingDepth is not none and options.matchingDepth > 0 -%}
{%- set options = options|merge({'matchingDepth': currentOptions.matchingDepth - 1}) -%}
{%- endif -%}
{%- for item in currentItem.children -%}
{%- set superadmin = currentSuperadmin or item.extra('superadmin', false) -%}
{{ block('item') }}
{%- endfor -%}
{# restore current variables #}
{%- set item = currentItem -%}
{%- set options = currentOptions -%}
{%- set superadmin = currentSuperadmin -%}
{% endblock %}
{% block item %}
{% if item.displayed %}
{{ block('linkElement') }}
{%- endif -%}
{% endblock %}
{% block linkElement %}
{%- set uri = item.hasChildren ? 'javascript:;' : item.uri -%}
<a href="{{ uri }}" class="kt-notification__item">
{{ block('label') }}
</a>
{% endblock %}
{% block label %}
{%- set icon = item.extra('icon')|default('') -%}
{%- set description = item.extra('description')|default('') -%}
{%- if icon is not null and icon is not empty -%}
<div class="kt-notification__item-icon">
{% include 'Admin/Inline/Icon/svgIcons.html.twig' with {'icon': icon } %}
{#<i class="{{ icon }}"></i>#}
</div>
{%- endif -%}
<div class="kt-notification__item-details">
<div class="kt-notification__item-title kt-font-bolder">
{%- if options.allow_safe_labels and item.getExtra('safe_label', false) -%}
{{ item.label|raw }}
{%- else -%}
{{ item.label }}
{%- endif -%}
</div>
{%- if icon is not null and icon is not empty -%}
<div class="kt-notification__item-time">
{{ description }}
</div>
{%- endif -%}
</div>
{% endblock %}