hook_menu: Normal Items and Local Tasks not playing well together
I'm trying hard to get these menu concepts here--I have a feeling there's already an answer on the boards, but I haven't found it.
In abstract, I would like to create a menu like this (the example code, posted further down, is a module I'm writing for the soul purpose to make sure I'm understanding how hook_menu works):
Page <- MENU_NORMAL_ITEM
Page/Subpage <- MENU_NORMAL_ITEM
Page/Subpage/Tab1 <- MENU_DEFAULT_LOCAL_TASK
Page/Subpage/Tab2 <- MENU_LOCAL_TASK
Page/Subpage/Tab3 <- MENU_LOCAL_TASKI do understand how the local tasks, at least in abstract, work. According to my train of thought (which may or may not be right) the previous menu structure, as rendered in Drupal, would look something similar to this:
Page
-SubpageSubpage would render the content in Page/Subpage/Tab1, as that is the default local task (right?). In addition, page/subpage would list at the top all local tasks as tabs (again, right?).
In short order, I'm wondering how to get Local Tasks and Normal Items to play well together. I can get Page and Page/Subpage working just fine in this tree-fashion as Normal Items, but as soon as I add Local Tasks to the child item, it just breaks and doesn't even put the child items in the database. I know it's possible--modules out there do this--and I just am at a loss to get mine to do the same.
Now, if someone has actually taken the time to get this far in my post (which I thank them for), maybe there's already a flaw in my logic.
The hook_menu I'm working with right now is as follows. All page callbacks are in the module as well.
<?php
function menutest_menu(){
$items = array();
$item['menu'] = array(
'title' => 'Menu',
'page callback' => 'menutest_1',
'access arguments' => array('access content'),
'type' => MENU_NORMAL_ITEM
);
$items['menu/tree'] = array(
'title' => 'Menu Tree Test',
'description' => "Nothing useful besides a hook_menu test.",
'page callback' => 'menutest_2_tab1',
'access arguments' => array('access content'),
'type' => MENU_NORMAL_ITEM
);
$items['menu/tree/list'] = array(
'title' => 'Menu Tab Test: \'List\'',
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10,
);
$items['menu/tree/add'] = array(
'title' => 'Menu Tab Test: \'Add\'',
'page callback' => 'menutest_2_tab2',
'access arguments' => array('access content'),
'type' => MENU_LOCAL_TASK,
);
$items['menu/tree/edit'] = array(
'title' => 'Settings',
'page callback' => 'menutest_2_tab1',
'access arguments' => array('access content'),
'type' => MENU_LOCAL_TASK,
'weight' => 5,
);
return $item;
}
?>Again, thank you in advance.
