Tell me more ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I am in the process of writing my 3rd custom module and this one is my biggest challenge yet. I know how to use hook_menu to generate menu items, and depending on the path you choose determines where they show up on the site (administration menu or main menu, etc).

My question is - how do I specify a NEW menu, so that the paths I create do not appear in "primary links" or "navigation" but in their own "custom module" menu?

share|improve this question

1 Answer

up vote 4 down vote accepted

You specify the menu_name parameter.

From the devel module:

$items['devel/cache/clear'] = array(
  'title' => 'Empty cache',
  'page callback' => 'devel_cache_clear',
  'description' => 'Clear the CSS cache and all database cache tables which store page, node, theme and variable caches.',
  'access arguments' => array('access devel information'),
  'menu_name' => 'devel',
);
share|improve this answer
Wow, thanks - so simple. – oranges13 Mar 24 '11 at 14:44
2  
Note that you will need to create your menu first in hook_install() or so. The menu system doesn't automatically create a menu for you. See drupalcontrib.org/api/drupal/… – Berdir Mar 24 '11 at 19:19
@Berdir thanks for the clarification! – oranges13 Mar 28 '11 at 21:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.