By Andrei Toutoukine on
Dear friends,
I would like to have a menu grouping item 'khimik', which contains two sub-items: 'manage issues' and 'add an article'. 'khimik' itself must lead to a page which gives the same choice i.e 'add an article' and 'manage issues'.
'add an article' leads to a form allowing the addition of a certain node type (which is 'khimik' for sure!) while 'manage issues' must call some dynamic page callback.
What I'm doing is (khimik.module):
function khimik_menu($may_cache)
{
global $user;
$items=array();
$is_typist = user_access('create khimik');
$is_editor = user_access('edit khimik');
if($may_cache) {
$items[] = array( 'path'=>'khimik', 'title'=>'khimik', 'access'=>($is_typist || $is_editor), 'callback'=>'khimik_page', 'type'=>MENU_ITEM_GROUPING);
$items[] = array( 'path'=> 'khimik/add_article', 'title' => t('Add an article'), 'access' => ($is_typist || $is_editor), 'type'=>MENU_NORMAL_ITEM );
$items[] = array( 'path' => 'khimik/manage_issues', 'title' => t('Issue management'), 'access' => ($is_typist || $is_editor), 'callback' => 'issues_manipulation_page', 'type' => MENU_NORMAL_ITEM);
}
return $items;
}
function khimik_page()
{
$out = '';
$out .= blah-blah-blah;
return $out;
}
// how to reference a form for creation the node of 'khimik' type???
// of course there's hook_form() for this node type!
function issues_manipulation_page()
{
$content = '';
$content .= blah-blah-blah;
print theme('page', $content);
}
For some reason 'khimik' tree is not shown for a user who has $khimik_typist===true.
All pages are available through manual path specification in a browser.
Drupal 4.6.x.
With the best regards,
Andrei
Comments
Just enable the GROUPING item!
Dear friends,
Next day after some thinking a solution was found:
With the best regards,
Andrei.
I'm using Drupal 5.1 and
I'm using Drupal 5.1 and having the same problem.
I couldn't find a GROUPING item to enable, but when I enable the Expanded option in the edit page of a specific menu item that my module implements as MENU_ITEM_GOUPING. It appears expanded in menu, but not act like a MENU_ITEM_GROUPING.