Guest User

Untitled

a guest
Mar 20th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. {% macro menu_links(items, attributes, menu_level) %}
  2. {% import _self as menus %}
  3. {% if items %}
  4. {% if menu_level == 0 %}
  5. <ul{{ attributes.addClass('menu') }}>
  6. {% else %}
  7. <ul class="menu">
  8. {% endif %}
  9. {% for item in items %}
  10. {%
  11. set classes = [
  12. 'menu-item',
  13. item.is_expanded ? 'menu-item--expanded',
  14. item.is_collapsed ? 'menu-item--collapsed',
  15. item.in_active_trail ? 'menu-item--active-trail',
  16. loop.last ? 'menu-item--last',
  17. item.title.getUntranslatedString() == 'Log in' ? 'item-login'
  18. ]
  19. %}
  20. <li{{ item.attributes.addClass(classes) }}>
  21. <a href="{{ item.url }}" title="{{ item.title }}" data-drupal-link-system-path="{{ item.url.getInternalPath() }}">
  22. <span>{{ item.title }}</span>
  23. </a>
  24. {% if item.below %}
  25. {{ menus.menu_links(item.below, attributes, menu_level + 1) }}
  26. {% endif %}
  27. </li>
  28. {% endfor %}
  29. </ul>
  30. {% endif %}
  31. {% endmacro %}
Add Comment
Please, Sign In to add comment