Taxonomy Menu rebuild deselects parent menu items of Menu Block

Jasu_M - August 20, 2009 - 09:47
Project:Menu block
Version:6.x-2.2
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

Rebuilding taxonomy menu breaks all menu blocks that use the menu. This is because Taxonomy Menu basically removes all menu items and recreates them when a rebuild is requested (or some important setting is changed for the vocabulary). This assigns new mlids for the recreated menu links. Also, Menu Block saves the parent menu with a menu-mlid pair.

Would it be possible to use menu-path pair to identify the menu parent instead? I think the patch for that should be fairly easy to make, assuming that this doesn't break any other use cases and that paths are unique within a menu. Is this an option at all?

Thank you in advance.

#1

Jasu_M - August 20, 2009 - 11:42

An idea for a solution: use both mlid and path for identification. This way, an update script doesn't have to be written and the changes will even be backwards compatible, keeping reverting to previous versions possible. The data format is now menu:mlid, this could be changed to menu:mlid:path, which is also compatible with the current code too (list($menu, $mlid) = explode( ... is used for reading). Then, mlid could be used as the primary method for fetching the item, and path as secondary.

Also, I checked, paths are unique within a menu.

#2

Jasu_M - September 25, 2009 - 14:25

Here's a patch (it's a recursive CVS patch, affecting menu_block.module and menu_block.admin.inc) even though I received no reply for this issue.

It does the following:
1. Tries to look up parent menu item by mlid.
2. If step 1 fails, tries by link path + menu name
3. If step 2 succeeds, saves to avoid double query the next time.

Admin page is changed so that it functions even if mlid is invalid, and also to save the path as well.

The format the string is saved in is also backwards compatible - older version of the module can be used with the new format as well (ie. rolling back to an old version works).

Is the patch fine as it is, and can it be integrated into the codebase?

Best regards,

Jasper Mattsson

AttachmentSize
menu_block-path_lookup.patch 6.5 KB

#3

temp - October 29, 2009 - 16:30

please attach patched file - i don't have ssh access
thanks for this feathure.

 
 

Drupal is a registered trademark of Dries Buytaert.