I use the Profile2 module and i get in the user edit view the secondary tabs with the extra profile information. How can i move it to the parent tabs and hide the child tabs: "Edit | Info".
1 Answer
Well, for each page, the type of tab is decided my a parameter 'type'. So you can do a hook_menu_alter() on the specific page to change that. Please have a look at the "Rendering Menu Items As Tabs" section of the documentation for hook_menu() to gain idea of what options do what.
-
I can only hide the tab, but other things doesn`t work. The tab is evertime hidden, also when i try to rename the title from the tab with these little function. function newtemplate_menu_alter(&$items) {$items['user/%user/edit/extra'] = array('title'=> 'info',)}– BrunoCommented Oct 4, 2013 at 15:52
-
Bruno, the stuff you wrote in your function will render the menu useless because you are overriding the entire menu definition with that array array('title'=> 'info'); So in effect your menu definition, if it was: $items['user/%user/edit/extra'] = array('page_callback' => '', 'access_callback' => '',) becomes just this: $items['user/%user/edit/extra'] = array('title'=> 'info'); I think you need to grab another level in the array and do something like this: $items['user/%user/edit/extra']['type'] = MENU_LOCAL_TASK; This will only change the type param– NeoCommented Oct 4, 2013 at 16:00
-
ok, i understand. it
s not so good to overwrite the array, but then should this work $items['user/%user/edit/extra']['title'] = 'info'; ... it doesn
t work, the tab is still not showing with the renamed title.– BrunoCommented Oct 4, 2013 at 16:50