templates/navigation/primary.html.twig line 1

Open in your IDE?
  1. {#
  2. project: Pimcore - Schutzverband Nuernberg Rostbratwuerste
  3. User: erikb
  4. Year: 2022
  5. #}
  6. {# get the document which should be used to start in navigation | default home #}
  7. {% set navStartNode = document.getProperty('navigation-root-primary') %}
  8. {% if not navStartNode is instanceof('\\Pimcore\\Model\\Document\\Link') and not navStartNode is  instanceof('\\Pimcore\\Model\\Document\\Page')%}
  9.     {% set navStartNode = pimcore_document(1) %}
  10. {% endif %}
  11. {% set mainNavigation = custom_build_nav(document, navStartNode) %}
  12. {% set home = navStartNode %}
  13.  {#
  14.  order: put it in front of all the others
  15.  uri: path to homepage
  16.  label: visible label
  17.  title: tooltip text
  18.  active: active state (boolean)
  19.  #}
  20. {# do mainNavigation.addPage({
  21.     order: -1,
  22.     uri: ('/' ~ document.getProperty('language')),
  23.     label: 'Home' | trans,
  24.     title: 'Home' | trans,
  25.     active: (document.id == navStartNode.id or document.id == 1)
  26. }) #}
  27. {% set menuRenderer = pimcore_nav_renderer('menu') %}
  28. {% set content %}
  29.     {% for page in mainNavigation %}
  30.         {# here need to manually check for ACL conditions #}
  31.         {% if page.isVisible() and menuRenderer.accept(page) and not page.getCustomSetting('navigationItemVirtual')  %}
  32.             {% set activeClassItem = page.getActive(true) ? 'navigation__item--active' : '' %}
  33.             <li class="navigation__item navigation__item--first {{ activeClassItem }} ">
  34.                 {% include 'navigation/partials/primary-link.html.twig' with { page: page, classes: ['navigation__link--first'] } %}
  35.                 {% if page.hasVisiblePages() %}
  36.                     {% set children = page.getPages() %}
  37.                     <ul class="navigation__container navigation__container--second">
  38.                     {% for childPage in children %}
  39.                         {% if childPage.isVisible() and menuRenderer.accept(childPage) and not childPage.getCustomSetting('navigationItemVirtual') %}
  40.                             {% set activeClassChildItem = childPage.getActive(true) ? 'navigation__item--active' : '' %}
  41.                             <li class="navigation__item navigation__item--second {{ activeClassChildItem }} ">
  42.                                 {% include 'navigation/partials/primary-link.html.twig' with { page: childPage, classes: ['navigation__link--second'], icon: 'harke' } %}
  43.                             </li>
  44.                         {% endif %}
  45.                     {% endfor %}
  46.                     </ul>
  47.                 {% endif %}
  48.             </li>
  49.         {% endif %}
  50.     {% endfor %}
  51. {% endset %}
  52. <nav class="navigation navigation--primary" aria-label="{{ 'wcag.label.navigation-primary'|trans }}" id="clickable-navigation">
  53.     <ul class="navigation__container navigation__container--first clickable-navigation">
  54.         {{ content }}
  55.     </ul>
  56. </nav>