{% set navStartNode = document.getProperty("mainNavStartNode") %}
{% set mainNavigation = pimcore_build_nav({active: document, root: navStartNode}) %}
{% set menuRenderer = pimcore_nav_renderer('menu') %}
<ul class="uk-nav">
{% for page in mainNavigation %}
{% if page.isVisible() and menuRenderer.accept(page) %}
{% set hasChildren = 0 %}
{% if page.hasPages() %}
{% for child in page.getPages() %}
{% if page.isVisible() and menuRenderer.accept(child) %}
{% set hasChildren = hasChildren + 1 %}
{% endif %}
{% endfor %}
{% endif %}
{% if hasChildren == 0 %}
{% if not page.getClass('apk-highlight-link') %}
<li class="{% if page.getActive(true) %}uk-active{% endif %} apk-highlight-link-container">
<a href="{{ page.getHref() }}" class="{{ page.getClass() }}" {% if page.getTarget() != NULL %} {{ page.getTarget() }} {% endif %}>
{{ page.getLabel()|trans }}
</a>
</li>
{% else %}
<li class="{% if page.getActive(true) %}uk-active{% endif %}">
<a href="{{ page.getHref() }}" class="{{ page.getClass() }}" {% if page.getTarget() != NULL %} {{ page.getTarget() }} {% endif %}>
{{ page.getLabel()|trans }}
</a>
</li>
{% endif %}
{% else %}
{% if not page.getClass('apk-highlight-link') %}
<li class="uk-parent apk-highlight-link-type {% if page.getActive(true) %}uk-active{% endif %}">
{% else %}
<li class="uk-parent {% if page.getActive(true) %}uk-active{% endif %}">
{% endif %}
{% if page.getClass('apk-highlight-link') %}
<a href="{{ page.getHref() }}" class="{{ page.getClass() }} apk-highlight-link-container" {% if page.getTarget() != NULL %} {{ page.getTarget() }} {% endif %}>
{{ page.getLabel()|trans }}
</a>
{% else %}
<a href="{{ page.getHref() }}" class="{{ page.getClass() }}" {% if page.getTarget() != NULL %} {{ page.getTarget() }} {% endif %}>
{{ page.getLabel()|trans }}
</a>
{% endif %}
{% set navBreakPoint = pimcore_website_config('main-nav-breakpoint') %}
{% if navBreakPoint is not empty %}
{% set countPage = page.getPages()|length %}
{% if countPage > breakpointChild %}
{% set countChild = (countPage / 2)|round %}
{% else %}
{% set countChild = null %}
{% endif %}
{% else %}
{% set countChild = null %}
{% endif %}
<ul class="uk-nav-sub">
{% set i = 1 %}
{% for child in page.getPages() %}
{% if child.isVisible() and menuRenderer.accept(child) %}
<li class="{% if child.getActive(true) %}uk-active{% endif %}">
<a href="{{ child.getHref() }}" class="{{ child.getClass() }}" {% if child.getTarget() != NULL %} {{ child.getTarget() }} {% endif %}>
{{ child.getLabel()|trans }}
</a>
</li>
{% endif %}
{% set i = i + 1 %}
{% endfor %}
</ul>
</li>
{% endif %}
{% endif %}
{% endfor %}
</ul>