navigation.html.twig 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. {% import _self as macros %}
  2. {% macro loop(page) %}
  3. {% import _self as macros %}
  4. {% for p in page.children.visible %}
  5. {% set current_page = (p.active or p.activeChild) ? 'active' : '' %}
  6. {% if p.children.visible.count > 0 %}
  7. <li class="has-children {{ current_page }}">
  8. <a href="{{ p.url }}">
  9. {% if p.header.icon %}<i class="fa fa-{{ p.header.icon }}"></i>{% endif %}
  10. {{ p.menu }}
  11. <span></span>
  12. </a>
  13. <ul>
  14. {{ macros.loop(p) }}
  15. </ul>
  16. </li>
  17. {% else %}
  18. <li class="{{ current_page }}">
  19. <a href="{{ p.url }}">
  20. {% if p.header.icon %}<i class="fa fa-{{ p.header.icon }}"></i>{% endif %}
  21. {{ p.menu }}
  22. </a>
  23. </li>
  24. {% endif %}
  25. {% endfor %}
  26. {% endmacro %}
  27. <ul class="navigation">
  28. {% if theme_config.dropdown.enabled %}
  29. {{ macros.loop(pages) }}
  30. {% else %}
  31. {% for page in pages.children.visible %}
  32. {% set current_page = (page.active or page.activeChild) ? 'active' : '' %}
  33. <li class="{{ current_page }}">
  34. <a href="{{ page.url }}">
  35. {% if page.header.icon %}<i class="fa fa-{{ page.header.icon }}"></i>{% endif %}
  36. {{ page.menu }}
  37. </a>
  38. </li>
  39. {% endfor %}
  40. {% endif %}
  41. {% for mitem in site.menu %}
  42. <li>
  43. <a href="{{ mitem.url }}">
  44. {% if mitem.icon %}<i class="fa fa-{{ mitem.icon }}"></i>{% endif %}
  45. {{ mitem.text }}
  46. </a>
  47. </li>
  48. {% endfor %}
  49. {% if config.plugins.login.enabled and grav.user.username %}
  50. <li><i class="fa fa-lock"></i> {% include 'partials/login-status.html.twig' %}</li>
  51. {% endif %}
  52. </ul>