In implementing hook_menu for a module, I am trying to put some items into a submenu.
So far I have something like this
$items['MyModule'] = array(
//...
'page callback' => 'system_admin_menu_block_page',
'file' => 'system.admin.inc',
'file path' => drupal_get_path('module','system'),
);
$items['MyModule/MenuItem1'] = array(
//...
);
$items['MyModule/SubMenu'] = array(
//...
'page callback' => 'system_admin_menu_block_page',
'file' => 'system.admin.inc',
'file path' => drupal_get_path('module','system'),
);
$items['MyModule/SubMenu/SubMenuItem1'] = array(
//...
);
I expect the SubMenu
to appear as, well, a submenu to the MyModule
menu, and for the SubMenuItems
to appear under that submenu. This is the default behaviour described at the Drupal API documentation.
- MyModule
- MenuItem1
- SubMenu
- SubMenuItem1
However, all items appear under the MyModule
menu.
- MyModule
- MenuItem1
- SubMenuItem1
- SubMenu
What am I doing wrong?
*EDIT: A typo (which I have fixed) caused SubMenu
to be a separate element rather than a child element of MyModule
. I still don't understand why SubMenuItem1
does not render under the SubMenu
, though.