Search code examples
phpdrupal-7megamenu

Drupal: Override Megamenu module function


I am a newbie to Drupal. I am using Megamenu dropdown to display the Main menu in the site I am working on. But I need to override a function(megamenu_theme_menu_tree) in the Megamenu module file to add some html to megamenu output. 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


Solution

  • In the file themes/[your_theme]/template.php, try to create a function to override it. 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.