templates/layout/nav/main-mobile.html.twig line 15

Open in your IDE?
  1. {% if not document is defined or not document %}
  2.     {% set document = pimcore_document(1) %}
  3. {% endif %}
  4. {% set navStartNode = document.getProperty('mainNavStartNode') %}
  5. {% if not 
  6.     (navStartNode is instanceof('\\Pimcore\\Model\\Document\\Page') 
  7.     or navStartNode is instanceof('\\Pimcore\\Model\\Document\\Folder')
  8.     or navStartNode is instanceof('\\Pimcore\\Model\\Document\\Link')
  9. ) %}
  10.     {% set navStartNode = pimcore_document(1) %}
  11. {% endif %}
  12. {% set mainNavigation = pimcore_build_nav({
  13.     active: document,
  14.     root: navStartNode
  15. }) %}
  16. {% set menuRenderer = pimcore_nav_renderer('menu') %}
  17. {% for page in mainNavigation %}
  18.     {% if page.isVisible() and menuRenderer.accept(page)  %}
  19.         {# has children #}
  20.         {% set hasChildren = false %}
  21.         {% for child in page.pages %}
  22.             {% if child._visible %}
  23.                 {% set hasChildren = true %}
  24.             {% endif %}
  25.         {% endfor %}
  26.         {# active #}
  27.         {% if page._active %}
  28.             {% set activeClass = 'active' %}
  29.         {% else %}
  30.             {% set activeClass = '' %}
  31.         {% endif %}
  32.         {# inactive or active with no children #}
  33.         {% set activeButtonClass = '' %}
  34.         {# active and has children #}
  35.         {% if page._active and hasChildren %}
  36.             {% set activeButtonClass = 'active' %}
  37.         {% endif %}
  38.         {% if not hasChildren %}
  39.             <li class="{{ activeClass }}">
  40.                 <a href="{{ page.getHref() }}">{{ page.getLabel() }}</a>
  41.             </li>
  42.         {% else %}
  43.             <li class="{{ activeClass }}">
  44.                 <a href="{{ page.getHref() }}">{{ page.getLabel() }}</a>
  45.                 <div class="subnav-toggler" data-subnav="{{ page.id }}">
  46.                     {{ include('svg/header/mobile/accordion.html.twig') }}
  47.                 </div>
  48.             </li>
  49.         {% endif %}
  50.     {% endif %}
  51. {% endfor %}