In my case each user has a gallery. Gallery is a node. I'd like to hide default "Create content" menu and add custom men开发者_运维知识库u link that links to user gallery.
function custom_menu() {
$items = array();
$items['galleries/editgallery'] = array(
'title' => 'Edit gallery',
'description' => 'edit gallery',
'page callback' => 'custom_edit_gallery',
'access callback' => 'custom_access_editgallery',
);
return $items;
}
function custom_edit_gallery (){
global $user;
$node = node_load ($user->gallerynid);
return node_page_view ($node);
}
But it doesn't show local tasks tabs(like "Edit" tab).
You would need to add them yourself.
- With normal theming, you could create a custom template file or overwrite a theme function etc to add the tabs you want.
- You could also do this within
hook_menu
, by usingMENU_LOCAL_TASK
andMENU_DEFAULT_LOCAL_TASK
, see the api.
精彩评论