Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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?".
Comment | File | Size | Author |
---|---|---|---|
#3 | menu-tree-build-703968-3.patch | 1.88 KB | JohnAlbin |
menu_block_build.patch | 2.4 KB | hefox | |
Comments
Comment #1
Nick Lewis CreditAttribution: Nick Lewis commentedCould you give a quick use case of what this change makes possible?
Comment #2
hefox CreditAttribution: hefox commented(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!
Comment #3
JohnAlbinLooking 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!