Posted by noobizness on February 23, 2010 at 9:20pm
I want to create a simple menu that routes you to node/mynodetype/add. however I want it to appear in a different place in my menu (admin/mymodule/addnodetype).
I know there must be a simple way in a custom module to create a menu item that just calls / redirects to another menu path (i.e., menu redirects to another url/path.)
A little help?
Comments
Have you tried adding it to the Navigaiton menu?
In most cases, if a user doesn't have privileges for a path, they won't see the menu item either.
Oh, wait. You have a custom module? Did menu callbacks in the module not work? The Admin menu is automated, so to put it in the Admin menu, you'll probably have to inject it via the menu API.
[duplicate deleted]
[duplicate deleted]
Thanks but: let me restate the environment.
I am writing a custom module and therefore, I want the creation of this menu to be programmatic rather than through the admin UI.
I am creating a custom content type that I want to, for convenience, be under its own menu cluster.
Say for the sake of argument that my module is named "Foo" and creates a content type "bar":
I want to create a menu at 'admin/foo' ( that is named 'Foo')
and I want to put crud under it:
'admin/foo/new_bar' (reading 'Create Bar') should be equivalent to '/node/add/bar'. However if I set its path to '/node/add/blog' it won't appear under the foo menu.
There are two conceptual ways to do this but I don't know how to execute them in Drupal:
1) create a page callback function that in turn routes the control to node add, telling it that I want to create content of type 'bar'.
2) somehow map 'admin/foo/new_bar' to '/node/add/bar' in the menu configuration.
Again: yes I can do this in menu admin but I need to do it in module code/config.
You should take a look at
You should take a look at pathauto's code.
Drupal evangelist.
www.CoderintheRye.com