Port to Drupal 6
faqing - February 20, 2008 - 00:16
| Project: | Menu Trim |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Description
I am using trim menu for all my sites. Please consider to update to D6. Many thanks.

#1
I will as soon as I have time.
#2
subscribing...
#3
subscribing
#4
Hello, Bear Brook (http://bearbrook.com) has sponsored a port of menu_trim to d6 which was just completed. Is there any interest in publishing it back to this module, or should I be looking at forking it and calling it something else?
#5
No need to fork... Please submit your patch here for review by the community. Thanks!
#6
Patch attached. Most of it is just changing the module to fit the d6 way of doing things, but the menu system rewrite in d6 obsoleted the easy ways to access root menus and submenus.
#7
The patch applied nicely, but in my tests I did not manage to get the menu trimmed... I could not investigate much, but the following condition is always false in menu_trim_block('view'):
if (menu_get_active_menu_name() == $delta)This is caused by menu_get_active_menu_name() always returning 'navigation' because no module has called menu_set_active_menu_name() to set my custom menu as active. Therefore, it looks like menu_get_active_menu_name() cannot be relied upon in D6 in the same way we did with _menu_get_active_trail_in_submenu() in D5.
#8
#9
Ah, I see the issue: menu_get_active_menu_name() returns the menu that the menu item was added to last; so if you had a link in one menu, it'll show up in a Menu trim block, but if you added that link to a second menu, it'll work for a Menu trim block for the second menu, but stop working for the first menu.
I have a few ideas on how to account for this; I'll test them out and roll a new patch.
#10
New patch attached. I'm really disliking the new menu system in d6. From my testing, there does not appear to be a way to test if the path is in the active menu without traversing the entire menu (that is, it's only set as a property for the last menu set).
I've tested this with a custom menu, built in menus, menu items appearing in multiple menus, and other various checks, but any additional testing would be appreciated.
#11
Any news on this module? The latests patch doesn't seem to work for me (drupal 6.8 install).
#12
@mlieshout: Can you provide more details on what doesn't work? Thanks.
#13
I followed the directions on how to configure the trimmed menu's but I get the whole primilary links menu twice. I can give you the url on pm if you want.
Thnx,
--
Maarten
#14
@David
I had a chat with Amorfati, he's acknowledged that the patch isn't working on the d6 release due to the changes in the menu-router. He's trying to rewrite the patch so that it will work again.
#15
Thanks for the update!
#16
Well, apparently the Menu Block module now seems to support most (if not all) of what Menu Trim used to provide. Its project page states:
This is great news. Can anyone report success with this feature in Menu Block?
#17
Menu Block can trim menus very easily like this:
Install Menu Block and activate it.
Then, on admin/build/blocks disable the default Primary links block.
Add two new menu blocks:
One for the first level of the menu, these are the settings:
Second one for the second level menus:
And activate the blocks.
I haven't tried this with more than 2 levels but it should be no problem.
#18
Menu Block can not replace Menu Trim.
Menu Block can not trim the items from the same level menu.
Please do to port Menu Trim to D6!!!
#19
@faqing: It might be a good idea to request any missing feature to the Menu Block project. I suspect that the maintainer will be keen on adding them. Menu Block is in a good position to supersede Menu Trim and many similar modules, and it is a good thing for everyone to join forces rather than maintaining a bunch of similar modules.
#20
Thanks anyway. I think I have no choice and go to use menu block.
#21
Until a final decision is made and announced on the project's page, let's keep this issue open for others to see.