{% set level = level|default(0) %}
{% set id = id|default('id') %}
{% set navType = navType|default('mega') %}
{% set trackingMainItem = trackingMainItem|default(null) %}
{% set trackingSubItemOne = trackingSubItemOne|default(null) %}
{% set trackingSubItemTwo = trackingSubItemTwo|default(null) %}
<section id="{{ id }}" class="{{ navType }}-nav {{ navType }}-nav--level-{{ level }} {{ styleModifier|default('') }}">
{% if hasMobileBackLink|default(false) %}
<button class="js-nav__list-toggle btn-no-styling {{ navType }}-nav--level-{{ level }}__go-back" aria-label="go back" data-nav-level="{{ level }}">
<span class="icon icon-arrow-left mr-2 {{ navType }}-nav--level-{{ level }}__go-back__icon"
aria-label="{{ 'navigation.back'|trans }}"
></span>
<span class="icon icon-{{ mobileBackLinkIcon }} {{ navType }}-nav--level-{{ level }}__go-back__text-icon"
aria-hidden="true"></span>
<span class="{{ navType }}-nav--level-{{ level }}__go-back__text">
{{ mobilBackLinkTitle }}
</span>
</button>
{% endif %}
<ul class="{{ navType }}-nav__list {{ navType }}-nav__list--level-{{ level }} list-unstyled js-nav__list {{ level == 0 ? 'js-nav__base-list' : '' }}" id="{{ id }}--list">
{% if title | default(null) and level == 1 or level == 2 %}
{% set trackingKey = 'l_' ~ level ~ '_' ~ title.text|replace({' ': '_'}) ~ '_0' %}
{% set trackingData = {
'trigger': 'click',
'datalayer': {
'event': 'navigation',
'main_item': level > 0 ? trackingMainItem : null,
'sub_item_one': level >= 1 ? level == 1 ? title.text|replace({' ': '_'})|lower : trackingSubItemOne : null,
'sub_item_two': level >= 2 ? level == 2 ? title.text|replace({' ': '_'})|lower : trackingSubItemTwo : null,
'click_item': title.text|replace({' ': '_'})|lower,
'click_page_location': title.href
}
} %}
{% do jsConfig('_trackingData').add({
(trackingKey): trackingData
}) %}
<li class="{{ navType }}-nav__title {{ navType }}-nav__title--level-{{ level }}" role="heading">
<a href="{{ title.href }}"
class="{{ navType }}-nav__title-link {{ navType }}-nav__title-link--level-{{ level }}"
data-event-tracking-key="{{ trackingKey }}">
{{ title.text }}
</a>
</li>
{% endif %}
{% for page in pages %}
{% if page.isVisible() %}
{% set isActive = page.isActive %}
{% set isOpen = page.isActive %}
{% set hasChildren = false %}
{% if page.hasPages() %}
{% for child in page.getPages() %}
{% if child.isVisible() %}
{% set hasChildren = true %}
{% endif %}
{% endfor %}
{% endif %}
{% set trackingKey = 'l_' ~ level ~ '_' ~ page.label|replace({' ': '_'}) ~ '_0' %}
{% set trackingData = {
'trigger': 'click',
'datalayer': {
'event': 'navigation',
'main_item': level > 0 ? trackingMainItem : null,
'sub_item_one': level >= 1 ? level == 1 ? page.label|replace({' ': '_'})|lower : trackingSubItemOne : null,
'sub_item_two': level >= 2 ? level == 2 ? page.label|replace({' ': '_'})|lower : trackingSubItemTwo : null,
'click_item': page.label|replace({' ': '_'})|lower,
'click_page_location': page.href|replace({' ': '_'})|lower
}
} %}
{% do jsConfig('_trackingData').add({
(trackingKey): trackingData
}) %}
<li class="{{ navType }}-nav__item {{ navType }}-nav__item--level-{{ level }} js-nav__list-item
{{ isActive ? 'is-active' : '' }} {{ isOpen ? 'is-open' : '' }}
{{ hasChildren ? 'has-children' : 'has-no-children' }}"
>
{% if hasChildren %}
<button aria-label="Open Menu" title="Open Menu" data-nav-level="{{ level }}"
class="btn-no-styling {{ navType }}-nav__item-content js-nav__list-toggle {{ navType }}-nav__item-content--level-{{ level }}"
data-event-tracking-key="{{ trackingKey }}"
>
<span class="d-inline-flex align-items-center w-100 justify-content-between">
{{ page.label }}
<span class="icon icon-chevron-right {{ navType }}-nav__item-content--level-{{ level }}__icon" aria-hidden="true"></span>
{% if isActive %}
<span class="visually-hidden-focusable">{{ 'navigation.current'|trans }}</span>
{% endif %}
</span>
</button>
{{ include('navigation/partials/nav-list.html.twig', page | merge ({
'level': level + 1,
'pages': page.pages,
'id': id ~ '-' ~ loop.index,
'navType': navType,
'parent': level == 0 or level == 1 ? '#' ~ id ~ '--list' : '',
'styleModifier': '',
'hasMobileBackLink': level == 0 or level == 1 ? true : false,
'mobilBackLinkTitle': level == 0 or level == 1 ? page.label | default(false) : false,
'mobileBackLinkIcon': false,
'title': {
'href': page.href,
'text': 'navigation.overview'|trans ~ ' ' ~ page.label
},
'trackingMainItem': level == 0 ? page.label|replace({' ': '_'})|lower : trackingMainItem,
'trackingSubItemOne': level == 1 ? page.label|replace({' ': '_'})|lower : trackingSubItemOne,
'trackingSubItemTwo': level == 2 ? page.label|replace({' ': '_'})|lower : trackingSubItemTwo
}), with_context = false) }}
{% else %}
<a href="{{ page.href }}" class="{{ navType }}-nav__item-content {{ navType }}-nav__item-content--level-{{ level }} {{ navType }}-nav__item-content--link" data-event-tracking-key="{{ trackingKey }}">
{{ page.label }}
{% if isActive %}
<span class="visually-hidden-focusable">{{ 'navigation.current'|trans }}</span>
{% endif %}
</a>
{% endif %}
</li>
{% endif %}
{% endfor %}
</ul>
</section>