简体   繁体   English

Drupal:覆盖Megamenu模块功能

[英]Drupal: Override Megamenu module function

I am a newbie to Drupal. 我是Drupal的新手。 I am using Megamenu dropdown to display the Main menu in the site I am working on. 我正在使用Megamenu下拉列表显示我正在处理的网站中的主菜单。 But I need to override a function(megamenu_theme_menu_tree) in the Megamenu module file to add some html to megamenu output. 但我需要覆盖Megamenu模块文件中的函数(megamenu_theme_menu_tree)以向megamenu输出添加一些html。 Editing the module file works for me, but I am not sure its the right way to do it. 编辑模块文件对我有用,但我不确定它是正确的方法。

Is there any other way to do it? 还有其他办法吗?

Please help 请帮忙

Thanks 谢谢

In the file themes/[your_theme]/template.php, try to create a function to override it. 在文件themes / [your_theme] /template.php中,尝试创建一个覆盖它的函数。 For naming function, it is explained here 对于命名功能, 这里解释

By the way, you should never override a function into its module. 顺便说一下,你永远不应该将一个函数覆盖到它的模块中。 You have to create your custom module to override it. 您必须创建自定义模块才能覆盖它。 It's easier to keep your custom code if you need to update Megamenu for example. 如果您需要更新Megamenu,则更容易保留自定义代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM