file menu--main.html.twig

Default theme implementation to display a menu.

Available variables:

  • classes: A list of classes to apply to the top level
      element.
    • dropdown_classes: A list of classes to apply to the dropdown
        element.
      • menu_name: The machine name of the menu.
      • items: A nested list of menu items. Each menu item contains:
        • attributes: HTML attributes for the menu item.
        • below: The menu item child items.
        • title: The menu link title.
        • url: The menu link url, instance of \Drupal\Core\Url
        • localized_options: Menu link localized options.
      1. {#
      2. /**
      3. * @file
      4. * Default theme implementation to display a menu.
      5. *
      6. * Available variables:
      7. * - classes: A list of classes to apply to the top level <ul> element.
      8. * - dropdown_classes: A list of classes to apply to the dropdown <ul> element.
      9. * - menu_name: The machine name of the menu.
      10. * - items: A nested list of menu items. Each menu item contains:
      11. * - attributes: HTML attributes for the menu item.
      12. * - below: The menu item child items.
      13. * - title: The menu link title.
      14. * - url: The menu link url, instance of \Drupal\Core\Url
      15. * - localized_options: Menu link localized options.
      16. *
      17. * @ingroup templates
      18. */
      19. #}
      20. {% extends "menu.html.twig" %}
      21. {%
      22. set classes = [
      23. 'menu',
      24. 'menu--' ~ menu_name|clean_class,
      25. 'nav',
      26. 'navbar-nav',
      27. ]
      28. %}

      Related topics