views:

7

answers:

1

In my case each user has a gallery. Gallery is a node. I'd like to hide default "Create content" menu and add custom menu 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).

A: 

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 using MENU_LOCAL_TASK and MENU_DEFAULT_LOCAL_TASK, see the api.
googletorp
I still believe it's can be done somehow without local task dublication. At least I can use menu_set_active_item ('node/37'); return menu_execute_active_handler();but this ruin my menu trails.
iflamberg

related questions