You are here

ultimenu.html.twig in Ultimenu 8

Same filename and directory in other branches
  1. 8.2 templates/ultimenu.html.twig

Default theme implementation for Ultimenu block (the UL list or container). If you need to customize the actual Flyout, use region.html.twig instead.

Available variables:

  • items: The renderable array containing the menu.
  • attributes.class: A string containing the CSS classes for the SECTION tag:
    • ultimenu ultimenu--ORIENTATION ultimenu--MENU-NAME SKIN-NAME.
    • ultimenu ultimenu--horizontal ultimenu--htb ultimenu--main ultimenu--blue

The following variables are provided for contextual information.

  • delta: (string) The ultimenu's block delta which is the cleaned menu name.
  • config: An array of the block's configuration settings. Includes
    • menu_name: main-menu
    • skin: modules/custom/ultimenu/skins/ultimenu--htb-tabs-blue.css
    • skin_name: ultimenu--htb-tabs-blue (based on safe CSS file name)
    • orientation:
      • ultimenu--htb: horizontal to bottom
      • ultimenu--htt: horizontal to top
      • ultimenu--vtr: vertical to right
      • ultimenu--vtl: vertical to left

File

templates/ultimenu.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation for Ultimenu block (the UL list or container).
  5. * If you need to customize the actual Flyout, use region.html.twig instead.
  6. *
  7. * Available variables:
  8. * - items: The renderable array containing the menu.
  9. * - attributes.class: A string containing the CSS classes for the SECTION tag:
  10. * - ultimenu ultimenu--ORIENTATION ultimenu--MENU-NAME SKIN-NAME.
  11. * - ultimenu ultimenu--horizontal ultimenu--htb ultimenu--main ultimenu--blue
  12. *
  13. * The following variables are provided for contextual information.
  14. * - delta: (string) The ultimenu's block delta which is the cleaned menu name.
  15. * - config: An array of the block's configuration settings. Includes
  16. * - menu_name: main-menu
  17. * - skin: modules/custom/ultimenu/skins/ultimenu--htb-tabs-blue.css
  18. * - skin_name: ultimenu--htb-tabs-blue (based on safe CSS file name)
  19. * - orientation:
  20. * - ultimenu--htb: horizontal to bottom
  21. * - ultimenu--htt: horizontal to top
  22. * - ultimenu--vtr: vertical to right
  23. * - ultimenu--vtl: vertical to left
  24. *
  25. * @see template_preprocess_ultimenu()
  26. */
  27. #}
  28. {%
  29. set classes = [
  30. 'ultimenu',
  31. 'ultimenu--' ~ delta,
  32. config.orientation ? config.orientation|clean_class,
  33. 'v' in config.orientation ? 'ultimenu--vertical' : 'ultimenu--horizontal',
  34. config.skin_name ? config.skin_name|clean_class,
  35. ]
  36. %}
  37. {%
  38. set item_classes = [
  39. 'ultimenu__item',
  40. 'uitem',
  41. ]
  42. %}
  43. {% spaceless %}
  44. {% if items -%}
  45. <ul id="{{ attributes.id|clean_id }}"{{ attributes.addClass(classes)|without('id') }}>
  46. {%- for item in items -%}
  47. <li{{ item.attributes.addClass(item_classes, item.flyout ? 'has-ultimenu') }}>
  48. {%- if item.link -%}
  49. {{ item.link }}
  50. {%- endif -%}
  51. {%- if item.flyout -%}
  52. <section{{ item.flyout_attributes.addClass('ultimenu__flyout') }}>
  53. {{ item.flyout }}
  54. </section>
  55. {%- endif -%}
  56. </li>
  57. {%- endfor -%}
  58. </ul>
  59. {%- endif %}
  60. {% endspaceless %}