You are here

footermap.html.twig in footermap: a footer site map 8

Footermap Template

Available variables:

  • footermap: The entire footermap render array, which may be printed as {{ footermap }} or iterated through with a for loop. Each key is the menu name and an array for each menu, which will render as a footermap header and its children as footermap items. It is possible to dig into a menu child and render only the children.

    • (children): Each element child represents a menu header keyed by the menu name containing the following values:

      • title: An optional title for the menu header if the menu header block configuration is enabled.
      • items: An array of menu links to render keyed by 'menu-' + the menu link id, and contains the following values:

        • title: The menu link title.
        • href: The menu link path or URL.
        • level: The depth of the child within the footer map.
        • language: The language of the menu link.
        • attributes: Attributes to apply to the footermap item.
        • children: Additional footermap items to render underneath this child similar to theme_item_list().

Advanced example:

{% for key, menu in footermap %} {% if key == 'main-menu' %} {% for item in menu.items %} <div{{ item.attributes }}>{{ item }}</div> {% endfor %} {% endif %} {% endfor %}

File

templates/footermap.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Footermap Template
  5. *
  6. * Available variables:
  7. * - footermap: The entire footermap render array, which may be printed as
  8. * {{ footermap }} or iterated through with a for loop. Each key is the
  9. * menu name and an array for each menu, which will render as a footermap
  10. * header and its children as footermap items. It is possible to dig into
  11. * a menu child and render only the children.
  12. * - (children): Each element child represents a menu header keyed by the
  13. * menu name containing the following values:
  14. * - title: An optional title for the menu header if the menu header
  15. * block configuration is enabled.
  16. * - items: An array of menu links to render keyed by 'menu-' + the menu
  17. * link id, and contains the following values:
  18. * - title: The menu link title.
  19. * - href: The menu link path or URL.
  20. * - level: The depth of the child within the footer map.
  21. * - language: The language of the menu link.
  22. * - attributes: Attributes to apply to the footermap item.
  23. * - children: Additional footermap items to render underneath this
  24. * child similar to theme_item_list().
  25. *
  26. * Advanced example:
  27. *
  28. * {% for key, menu in footermap %}
  29. * {% if key == 'main-menu' %}
  30. * {% for item in menu.items %}
  31. * <div{{ item.attributes }}>{{ item }}</div>
  32. * {% endfor %}
  33. * {% endif %}
  34. * {% endfor %}
  35. */
  36. #}
  37. {% for key, menu in footermap %}
  38. <nav class="footermap-col footermap-col--{{ loop.index }} footermap-col--{{ key }}">
  39. {{ menu }}
  40. </nav>
  41. {% endfor %}