So I create a menu item called Sponsorship in administration in the following way:

function eac_sponsorship_menu() {
  $items['admin/sponsorship'] = array(
    'title' => 'Sponsorship',
    'description' => 'This is where all of the child sponnsorship data is stored',
    'page callback' => 'system_admin_menu_block_page',
    'file path' => drupal_get_path('module', 'system'),
    'file' => 'system.admin.inc',
    'access callback' => 'user_access',
    'access arguments' => array('access sponsorship section'),
    'plid' => 1,
    'weight' => -500,
    'expanded' => TRUE,
    return $items;

If I want to create another menu item directly after this, in the same function, how do I make it a child to this previously defined 'Sponsorship' menu item?

I have seen examples that use a DB lookup to get the plid value. This seems a bit counter intuitive bearing in mind I've only just created the Sponsorship menu item, is there a simple way to do this using the API?

For example

$items['admin/sponsorship/child'] = array(
  'plid' => //simple API function to get admin/sponsorship mid?


I think I've just answered my own question...I don't need to define plid, the path of the array $items is enough:


Is this correct?

| improve this question | | | | |
  • I think I've just answered my own question...I don't need to give plid, the path in $items is enough. Is this correct? – Scott Lawrence Feb 6 '13 at 21:51
  • Yes, the url path should suffice for the default menu hierarchy there. – David Thomas Feb 6 '13 at 21:53

An example child item would just fall under the parent item in the path hierarchy, no need for plid.


  $items['admin/sponsorship/child'] = array(
    'title' => 'Sponsor child',
    'description' => 'This is where all of the child sponsorship data is stored',
    'page callback' => 'mymodule_sponsor_child_page',
    'access arguments' => array('access sponsorship section'),
    'type' => MENU_NORMAL_ITEM

system_menu has some good examples of menu item containers, using system_admin_menu_block_page, e.g admin/appearance/*

Make sure you clear menu cache to get any new menu item to show up there.

| improve this answer | | | | |
  • 1
    How about if you cannot have it naturally fall under the item, like in the case of <nolink> items? – DrCord Oct 31 '14 at 16:15
  • Exactly, that is the same problem I am having DrCord. And I think the solution lies with specifying the "plid", but I'm not sure. I opened a new question regarding it, here: stackoverflow.com/questions/33646421/… – coderama Nov 11 '15 at 8:31
  • Sometimes you have to re-enable a module to make hierarchical changes effective. – bloke_zero Feb 8 '16 at 11:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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