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

CommentFileSizeAuthor
#2 taxonomy_menu-446714.patch1.13 KBmuhleder

Comments

indytechcook’s picture

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!

muhleder’s picture

Status: Active » Needs review
StatusFileSize
new1.13 KB

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.

indytechcook’s picture

Status: Needs review » Reviewed & tested by the community

Commited to Latest DEV

indytechcook’s picture

Status: Reviewed & tested by the community » Fixed

Added to 2.4-beta1.

Status: Fixed » Closed (fixed)

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