Hello again, all.

I'd like to know if it's possible to override a custom module's implementation of hook_block() from within a theme.

Specifically, I'd like to use Nice Menus, and override nice_menus_block() so that I can have parallel horizontal menus. Details on how to do that are here:
http://drupal.org/node/248365

However, this page calls for hacking the nice_menus.module code, which is not really the "Drupal way." It's already possible to use a custom CSS file to create the necessary classes, so we're already halfway there.

It's my understanding that creating a MYTHEME_block() function in template.php will override the Drupal's core hook_block() function, but I don't know how it would affect things with a custom module.

Sorry if this has been asked and answered. I couldn't find it through a search, and the docs for module development and theme development aren't integrated enough for me to find an answer easily.

Comments

pddrupal’s picture

Hi Karl,

you can only override theming functions -theme_function()- via template.tpl.php. To override all other functions you need a custom module or hack / tweak nice_menu.module to your needs as explained at 248365.

It's true that hacking Drupal core is a no-no and should be avoided all the times for many reasons. Still implementing a custom module to override a contributed one is probably more complicated than just adding a small tweak nice_menu directly. My 2 cents of course ;)

Karlheinz’s picture

Yeah, I suspected as much.

I'll suggest it as a patch to the module itself, then.

-Karlheinz