Probably it’s a simple problem – but though I searched in the forums for hours I didn’t find a solution that works for me. So I ask for help:
I want to build a dynamic menu in Drupal 5 in which I want to display menu items for some particular nodes (witch I calculate depending on the taxonomy system).
In my module I tried to insert a menu item with:
$items[] = array(
'path' => 'node/15',
'title' => $title,
'type' => MENU_NORMAL_ITEM,
'access' => TRUE
);
But this menu item isn’t shown in any menu! And even if it would be shown I am not able to determine where (in which menu and at which position) it would be shown, because this is determined by the ‘path’, which is 'node/15' instead of 'navigation/itemname'.
So I tried to do it with:
$items[] = array(
'path' => 'navigation/itemname',
'title' => $title,
'callback' => 'drupal_goto',
'callback arguments' => array('node/15'),
'type' => MENU_NORMAL_ITEM,
'access' => TRUE
);
Now the menu item is shown in the menu ‘navigation’ and if I click on this menu item the right node is called. But this is true only if the menu item is at the first level. If it is deeper in hierarchy the menu does not open and the menu item isn’t shown as active. Well I think, this might be ok, because the node which is shown is 'node/15' while the menu path is 'navigation/itemname'. So there is no reason to activate the menu.
So I tried to tell Drupal that 'navigation/itemname' is the active item by adding to the hook_nodeapi:
case 'view':
menu_set_active_item('navigation/itemname');
break;
Result: The menu opens and the menu item is active. But now Drupal does not know any more that the shown node is 'node/15' and so the tabs ‘view’ and ‘edit’ aren’t shown any more.
Well, now I am at my wits’ end and hoping someone can tell me what I’m doing wrong. Many thanks in advance!
Comments
Comment #1
ainigma32 commentedLooks like you got the answer here http://drupal.org/node/235899 Setting this to fixed.
Feel free to reopen if you think that is incorrect.
- Arie
Comment #2
smitty commentedWell, there were some discussions in http://drupal.org/node/235899. But nothing did help. So this issue is still open.
Although I used another approach in the meantime (I used 'normal' links and used some css to make them look like menu-items) I would be glad to know how it would work with the menu system.
Comment #3
ainigma32 commentedBumping this issue. @smitty: Did you make any progress or were you waiting for input from the community?
- Arie
Comment #4
smitty commentedStill waiting for a solution.
Comment #5
ainigma32 commentedOK. Well at least it's a the top of the pile again ;-)
- Arie
Comment #6
ainigma32 commented@smitty: Looks like you're not getting much attention in this little corner of the community.
So .. how about IRC or maybe the developers mailing list? Have you tried asking around there?
- Arie
Comment #7
ainigma32 commentedLooks like smitty won't be posting any feedback so I'm setting this to fixed.
Feel free to reopen if you think that is wrong.
- Arie
Comment #8
smitty commentedWell, its not fixed. But at the moment I do not have time to do further investigations.
Comment #9
tr commentedDrupal 5 is no longer supported, so unfortunately this issue will have to close without a resolution. Drupal 6 introduced an entirely new menu system, so the problem isn't relevant to newer versions of Drupal, but if you have a similar problem in Drupal 6 or higher please open a new issue.