Use-case: Use Menu Block to output a permanently displayed footer tree menu.
Instead of just outputting a whole menu (f.e. primary links), I need to display selected sub-menu-trees from a menu in separate blocks. Additionally, those menu blocks should be displayed expanded and on all pages, regardless of whether the current page/path is in the menu.
For example, imagine the following primary links structure:
Home
About
- Page 1
- Page 2
News
- Category 1
- Category 2
Contact
If I would only add the option to output the menu block permanently, I could display the whole menu tree structure in the footer. However, "Home" and "Contact" would not make much sense there, because they do not have any children. Also, linking to the top-level menu items "About" and "News" may not be wanted.
So my goal is to allow to select the starting menu item from the chosen menu, as well as displaying a menu expanded and permanently, so f.e. one can configure the following two blocks:
About
- Page 1
- Page 2
News
- Category 1
- Category 2
...where the block title may or may not be linked.
Comment | File | Size | Author |
---|---|---|---|
#5 | menu_block-331934-5-menu-item.patch | 7.08 KB | JohnAlbin |
#4 | menu_block-331934-4-menu-item.patch | 7.66 KB | JohnAlbin |
#3 | menu_block.patch | 5.52 KB | smk-ka |
Comments
Comment #1
JohnAlbin+1 to this feature. I've read each of the points you made carefully, and I agree with them all. I can tell you've though out the implementation. :-)
BTW, we've got a site that will require this, but its not due until January.
Comment #2
JohnAlbinWoot!
Turned out I needed this sooner rather than later. And I've got some working code on my system. :-D
I'll post a patch or commit it sometime over the holiday.
Comment #3
smk-ka CreditAttribution: smk-ka commentedBetter doin' it twice than never at all... I finished a patch of sun a few days ago, but would very much like to see your solution, too.
Patch needs testing.
Comment #4
JohnAlbinIf the menu item you select is outside the active trail, the menu item won't even be in the tree returned by menu_tree_page_data(). Also, the "refresh" button doesn't do anything yet, does it? :-)
I'm not crazy about my approach, but here's the patch. I feel like all this tree traversal is wasteful, but without a complete re-write of how the tree data is retrieved, this is probably the best method.
Comment #5
JohnAlbinRe-rolled after #330978: Add hook_get_menus() and implement Book module integration
Comment #6
JohnAlbinCommitted. http://drupal.org/cvs?commit=155767