Areas effect: _menu_block_block_view, menu_block_set_title
Added function: menu_block_build

Moves around the code a bit to put the main processing in one re-usable function that other modules can use.

Possible change: at the moment delta is passed in and used in the theme function for class names, perhaps documentation needed to say "delta will be used in the theme function for classes, so please use something unique when using this outside of menu blocks?".

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Nick Lewis’s picture

Could you give a quick use case of what this change makes possible?

hefox’s picture

(Answered on IRC but going to answer here)

Main motivation is future ctools intergration (instead of going through add a block under block config then go to ctools add a block there, will be able do settings in ctools), but I've also found it useful for doing blocks in code (ease updating existing sites, and I can easily verison control blocks in code better) and using as a wrapper for other modules that provide menu displays; Imagine in nice menus used it as a wrapper; could do nice wrappers for parts of a menu also possibly o.o!

JohnAlbin’s picture

Title: menu_block_build to allow reuse of menu_block outside of menu block blocks » Add menu_tree_build() to allow reuse of tree building code
Status: Active » Fixed
FileSize
1.88 KB

Looking at this patch made me realize that the menu_block_set_title and menu_block_get_title APIs are WTFs. I've refactored them slightly so that they now make sense. :-p

I also recently added the ability for hook_menu_tree_alter() to alter the $config in addition to the $tree.

Those two refactorings make this issue trivial. I've attached the patch that was committed.

Thanks, hefox!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.