开发者

Theme a custom menu with theme_menu_tree()

开发者 https://www.devze.com 2023-03-22 10:59 出处:网络
I\'m trying to override a custom menu output in a block so that instead of <ul class=\"menu\">...</ul>

I'm trying to override a custom menu output in a block so that instead of

    <ul class="menu">...</ul>

I can get

    <select name="menu title">...</select>

In Drupal 6, I could use functio开发者_如何转开发n theme_menu_tree($tree,$menu_name="") {...} but this doesn't work in Drupal 7 with function theme_menu_tree($variables) {...}.

I've tried theme_menu_tree__mymenu($variables) {...} with no success. How do I specify a unique menu in Drupal 7?

Thanks.


I had the same problem with overriding and correct naming of the theme_menu_tree function for a specific menu name. What I found I suppose that the correct name of your function should be: YOUR_THEMENAME_menu_tree__YOUR_MENUNAME

The name of your menu could be taken from Administration » Structure » Menus pages. It seems to me that Drupal adds word "menu" before all of the new user menus. In my case I created a menu called "Testing menu" in a theme "Mytheme" and the name of the overriding function was: mytheme_menu_tree__menu_testing_menu

0

精彩评论

暂无评论...
验证码 换一张
取 消