Using hook_theme() to allow override of display.

arcaneadam - October 5, 2009 - 18:13
Project:Menu block
Version:6.x-2.x-dev
Component:User interface
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs review
Description

First off I love this module. I use it in most of my sites. It's a great way to just have people create a logical menu tree using primary links and still have the different levels show up on parent pages. BRAVO!

I just wanted to share a patch I made for this code though to allow for greater access to the core theming system. Basically I change menu_block_tree_output() to theme_menu_block_tree_output(), inserted the appropriate value for this into hook_theme, and changed all calls to the previous function to call theme('menu_block_output',$tree). This has been great as now I can easily override some of the display and output on the theme level without having to modify the module(which wasn't an option since I work almost exclusively in multisite environments).

Anyway I would hope this would make it into the next release of this module to allow others the ability to do this.

#1

arcaneadam - October 5, 2009 - 18:17

Patch file

AttachmentSize
menu_block-59604.patch 1.65 KB

#2

armyofda12mnkeys - November 8, 2009 - 05:43

Can you give an example how you would use this?

I was looking for overriding a menu block so between the list item and hyperlink, it has a div surrounding it (so i can use sifr to target it easily as sifr seems to have trouble with targetting lists when it has sublists). Something to target between them will allow me to target the sifr css rules better i think

 
 

Drupal is a registered trademark of Dries Buytaert.