For some reason, Drupal splits apart the UL HTML element for menus, and has two separate theme functions, theme_menu_tree for the UL part, and theme_menu_link for the LIs inside it.

This is not the way a front end developer thinks. This is one HTML element, and should be managed in one theme function. I propose that we create a menu.html.twig template that outputs the whole menu at once. This template can have theme_hook_suggestions for different menus, different positioning, etc, but it should be but one theme function theme('menu')

This should not use the theme_item_list function. When a front end developer overrides the menu template, it will probably be for the reason that they are trying to change it into something other than an item list, and having an item-list--menu template at that point would be horribly confusing. Additionally, when you are trying to locate the template for a menu, you will be thinking "menu" not "item list".

Comments

jenlampton’s picture

Status: Active » Closed (duplicate)