主题与theme_menu_tree()的自定义菜单 [英] Theme a custom menu with theme_menu_tree()

查看:228
本文介绍了主题与theme_menu_tree()的自定义菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图覆盖块中的自定义菜单输出,而不是

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

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

我可以得到

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

在Drupal 6中,我可以使用函数 theme_menu_tree($ tree,$ menu_name =){...} 但是这不能在Drupal 7中使用函数 theme_menu_tree($ variables){...}

In Drupal 6, I could use function theme_menu_tree($tree,$menu_name="") {...} but this doesn't work in Drupal 7 with function theme_menu_tree($variables) {...}.

我尝试过没有成功的 theme_menu_tree__mymenu($ variables){...} 如何在Drupal 7中指定一个独特的菜单?

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

谢谢。

推荐答案

与具体菜单名称的theme_menu_tree函数的覆盖和正确命名相同,我遇到了同样的问题。我发现我认为您的函数的正确名称应该是: YOUR_THEMENAME_menu_tree__YOUR_MENUNAME

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

您的菜单的名称可能从管理»结构»菜单页面。在我看来,Drupal在所有新的用户菜单之前添加了单词menu。
在我的情况下,我在主题Mytheme中创建了一个名为Testing menu的菜单,覆盖函数的名称是: mytheme_menu_tree__menu_testing_menu

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

这篇关于主题与theme_menu_tree()的自定义菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆