navigation.html.twig 733 B

12345678910111213141516171819202122232425
  1. {% macro nav_loop(page) %}
  2. {% for p in page.children.visible %}
  3. {% set active_page = (p.active or p.activeChild) ? 'active' : '' %}
  4. {% if p.children.visible.count > 0 %}
  5. <li>
  6. <a href="{{ p.url }}" class="{{ active_page }}">
  7. {{ p.menu }}
  8. </a>
  9. <ul>
  10. {{ _self.nav_loop(p) }}
  11. </ul>
  12. </li>
  13. {% else %}
  14. <li>
  15. <a href="{{ p.url }}" class="{{ active_page }}">
  16. {{ p.menu }}
  17. </a>
  18. </li>
  19. {% endif %}
  20. {% endfor %}
  21. {% endmacro %}
  22. <ul {{ tree ? 'class="tree"' : '' }}>
  23. {{ _self.nav_loop(pages) }}
  24. </ul>