By Hubert_r on
Hello everyone,
When we use hook_menu to create a menu item, and if we use NORMAL_MENU_ITEM, it adds it to the "navigation" menu.
1) Is it possible add it to another menu?
2) How can we actually create another menu programmatically?
Many thanks,
Hubert.
Comments
category
category.module is the only place i know of where this sort of thing being done.
Via Modules
Good place to start:
http://api.drupal.org/api/5/function/hook_menu
http://api.drupal.org/api/5/group/menu
Sorry about that
I answered too quickly. From my understanding hook_menu can only return menu items to the "Navigation" menu. An admin has to manually move it to another menu. Please correct me if I'm wrong, because I would love to have this functionality as well.
No idea on creating a brand new menu programmatically.
Well, that's what I thought,
Well, that's what I thought, it doesn't seem to be feasable right now.
It would be a great addition, though.
I had a look at the category module a while ago, when I worked on my first Drupal site, but although it is a great module I prefer to use as much as the core functionality as I can (due to upgrade and maintenance issues)
It is possible with menu_save_item()
Here's a function I used to create a menu from on terms found in a vocabulary.
You may need to clear your cache after running this function.
function for changing node/{nr} to taxonomy/term/{nr}
Hi,
I see this function which creates menu items from taxonomy terms.
I have worked with the category module and I am not ok with this module, so I changed strategies to go back to taxonomy module. I stated the reasons why here: http://drupal.org/node/147279
Can you tell me how I may be can use your function to change the node/{nr} type 118 menu items (the old category module items) to taxonomy/term/{nr} items?
It would be great if this is possible!
Thanks in advance,
greetings,
Martijn
www.best-information.eu
menu_save_item deprecated in 6.x
This is something I did to create an empty menu:
To add a menu item to a
To add a menu item to a particular menu send the parent id value with the menu item as follows:
$items['menu_item']['pid'] = $pid;
eg:
$items['path'] = array(
'access' => $access,
'callback' => 'my_callback',
'description' => t('description'),
'path' => $path,
'title' => $name,
'weight' => 0,
'pid' => $pid
);
{menu_custom}
Look for system_update_6021()
Or look for menu_install()
Created new feature request: #449996: Function or hook for creating new menu_custom
Hi, I want to build a menu
Hi,
I want to build a menu using the combination of 3 vocabularies, say A, B and C
And want to build menu items like : "page-panel-name/A1/B1/C1, "page-panel-name"/A1/B1/C2 etc.....
(A1, B1, C1 and C2 are term names)
How can I deal with this using custom code please?
Thanks a lot in advance for your reply!
It sounds like you are after
It sounds like you are after something like this module.
While it doesn't use term names in the url it uses the term tids. If the module does what you want and you want term names then contact me and I'll see what I can do.
Hi, Thanks for your
Hi, Thanks for your module!
The problem is with: "single level vocabularies". I tell you my use case:
I have a vocabulary: regional with
-countries
---regions
-------places
I have a vocabulary: camping sorts
-kidscamping
-nature-camping
etc..
and I have a vocabulary: specialities:
-swimmingpool
-restaurant
etc..
Next to this I have a page/panel on which I show differetn panes. The name of the panel is over
So what I would like is be able to build a menu with all these factors combined.
The url's in this menu should be:
Would this be possible with your module?
greetings,
Martijn
Only single level vocabularies
Unfortunately the module only does single level vocabularies. Coincidentally I have combined it with places in another module here called jobplus. This uses the addresses module to provide the location country and province/state so that you can search for categories within a country and a province/state. Here it is used for jobs but I could separate it out for generic use if you felt it is worthwhile. There's in implementation of the module here: http://www.dermpedia.org/jobs/7/21/36 .You can see there is a decent breadcrumb and informative blocks.
Hi Kent, That would be great
Hi Kent,
That would be great to seperate out for generic use!
I do not know a correct module name, may be you are creative in this?
I would very much like to use the different taxonomies and be able to set a custom "word" before this combination.
Functionality:
1. Be able to set a word after the base_url (this way pages/panels/views can be triggered with arguments)
2. Be able to select 1 or 2 or 3 vocabularies
3. output urls using the word and output possible combinations in a order of choice and the hierarchy of the taxonomies shown automatically, like a sort of sitemap!
Thanks for your help in advance!
greetings, Martijn
Could someone please explain
Could someone please explain me what is the final verdict on this one?
Here's the best answer I found to this question
http://drupal.stackexchange.com/questions/41570/create-a-menu-programmat...