{#
/**
 * @file
 * Default theme implementation to each level of menu.
 */
#}
{% import _self as menu %}
{{ menu.menu_links(items, attributes, 0) }}
{% macro menu_links(items, attributes, menu_level) %}
	{% if items|first.menu_level == 0 %}
		{% set classSubMenu = "dropdown-content dropdown-menu" %}
		{% set classMenu="sub-menu w-100" %}
	{% else %}
		{% set classSubMenu = "dropdown-content-sub" %}
		{% set classMenu="sub-sub-menu" %}
	{% endif %}
	<div class="{{classMenu}}">		
		<ul class=" menu menu-level-{{ items|first.menu_level }} navbar">
			{% for key, item in items %}
{% if key|first != '#' %}
    
								{% 
            set menuId = 'item-id-' ~ item.entity.id()
        %}
				{% set menu_item_classes = [
          'menu-item',
          items|first.menu_level == 0 ? 'dropdown nav ',
          item.below and items|first.menu_level == 0 ? 'has-submenu0',
          items|first.menu_level != 0 ? 'dropdown-item',
          item.is_expanded ? 'menu-item--expanded',
          item.is_collapsed ? 'menu-item--collapsed',
          item.in_active_trail ? 'menu-item--active-trail',
          item.content['#is_empty_layout'] == false and items|first.menu_level == 0 ? 'has-submenu0',
          menuId
    ] %}    
				<li{{item.attributes.addClass(menu_item_classes)}}>
					{% if items|first.menu_level == 0 %}
						{% if (item.content['#is_empty_layout'] == false and items|first.menu_level == 0) or (item.below and items|first.menu_level == 0 ? 'dropdown-toggle') %}
							{% set ClassA= {'class':['dropdown-toggle'],'data-toggle':'dropdown','aria-expanded':false,'id':menuId} %}
						{% else %}
							{% set ClassA={} %}
						{% endif %}
						{% if item.title and item.url %}
						    {{ link(item.title, item.url) }}
						{% endif %}
					{% endif %}
					{% set rendered_content = item.content|without('')|render %}
					{% if rendered_content %}
						<div class="{{classSubMenu}}" aria-labelledby="{{menuId}}">
							{{ rendered_content }}
						</div>
					{% endif %}
				</li>
			{% endif %}
			{% endfor %}
		</ul>
	</div>
{% endmacro %}