Taxonomy Menu API hooks

muhleder - April 27, 2009 - 22:54
Project:Taxonomy Menu
Version:6.x-2.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

I'm wondering if anyone has had any luck using the _taxonomy_menu_insert or _taxonomy_menu_update hooks? When I implement them in a custom module the menu items don't work, ie links are not created when the menu is rebuilt.

The problem seems to be that (line 423, taxonomy_menu.module)


  //let other modules make edits
  $item = module_invoke_all('taxonomy_menu_'. $op, $item);

returns a merged array of $items which the later code cannot understand.

So instead of an array like

$item
  tid => 168

we get an array of the form
$item
  tid
    0 => 168
    1 => 168

I'm thinking that module_invoke_all is the wrong thing to use in this case, and it would work if $item was just passed by reference to each module implementing the hook?

Could write up a patch for this if I'm not completely off track.

Thanks,

Mark

#1

indytechcook - April 28, 2009 - 01:00

I use the hooks in the original module, but only once. I guess when you use it more then once you get that array.

Kind of link an _alter hook... interesting. I think that fits the vision better also.

Go for the patch!

#2

muhleder - April 30, 2009 - 13:25
Status:active» needs review

Ok, here's a patch which is working for me. Haven't used this structure before

    $function = $module .'_'. $hook;
    $function($item);

but it seems to call the required functions ok.

AttachmentSize
taxonomy_menu-446714.patch 1.13 KB

#3

indytechcook - May 19, 2009 - 21:20
Status:needs review» reviewed & tested by the community

Commited to Latest DEV

#4

indytechcook - August 30, 2009 - 02:07
Status:reviewed & tested by the community» fixed

Added to 2.4-beta1.

#5

System Message - September 13, 2009 - 02:10
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.