Hi im a bit confused, i thought i would be able to add tabs like 'view' 'edit' on all of my pages in an easy way. But now it seems i have a problem. Im a noob so please excuse me if im totally wrong :- )
It seems that menu_router has PK on path and that path is used as a "link to" on my tab. Also, definition of a local task or any other menu item has a path as index like this:
$items['node/%node'] = array(
'title callback' => 'node_page_title',
'title arguments' => array(1),
'page callback' => 'node_page_view',
'page arguments' => array(1),
'access callback' => 'node_access',
'access arguments' => array('view', 1),
'type' => MENU_CALLBACK);
$items['node/%node/view'] = array(
'title' => 'View',
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10);
$items['node/%node/edit'] = array(
'title' => 'Edit',
'page callback' => 'node_page_edit',
'page arguments' => array(1),
'access callback' => 'node_access',
'access arguments' => array('update', 1),
'weight' => 1,
'file' => 'node.pages.inc',
'type' => MENU_LOCAL_TASK,
);
So seems like i cant define same destination path for 2 menu tasks can i?
Id like to have my tabs visible on each of those pages. Then user does not have to scroll down to cancel etc, he could just click on tabs to switch views easily.
Could anyone please give me some hint to help me with that? :- )
Thanks a lot!
Artur
[Edited to add <code> and </code> tags: nevets]
Comments
Local menu tasks are
Local menu tasks are specific to a path so it does not make sense for them to show on just any page. The code you show is from the node module and shows how they set up tabs for node pages. These tabs show for anyone with the correct permissions. If what you want to do is add additional tabs to a node page you can do that you just need to use a unique path, say 'node/%node/your_path' and define the callback etc.
I really need tabs
Yes thats what i was afraid of. The code i pasted in was just to visualize what i was talking about. But i really have to make it possible. Our users want to have this kind of navigation and they want to be able to switch between views of the same context.
So you recommend this is not the way to do it and i have to add these tabs myself with some markup in the module? Or is there any 'tab-like' feature or module available?
Thanks a million for reply :- )
Art
--------
http://artur.ejsmont.org
I guess it depends on what
I guess it depends on what you mean by "they want to be able to switch between views of the same context." If you mean the views module, views can directly deal with adding tabs. If not, what do you mean by same content and what are they viewing?
more details
ok sorry for that :- )
lets say you have a product. You want to find the product and then you want to be able to do all the stuff you need without leaving the context of this chosen product. You just see tabs at the top like view, edit, process, manage or whatever. Clicking on any of tabs shows you all of the tabs again just the activa tab is different. Below the tabs you see form or other content depending on which tab are you on.
In node module you see tabs only on 'view' page, but once you click on revisions or edit all the tabs are gone. Which is ok i guess, but maybe it would be nice to still show them so you can go back or go do other stuff with your node without back button nor scrolling for cancel. Any way, node module is out of scope for me as i'm too fresh in drupal to give any advices on how should it work ;- )) i think thinking behind is that local task is local and that showing tabs on some screens might encourage to leaving page without saving .... so thats fair enough. im just saying it to give you the background of what am i looking for.
btw. pages will be custom made for the module but i might have to add some tabs to node or other modules as well to have similar behavior and then .... can i do it without changing those modules? would prefere to keep away from core stuff to allow smooth upgrades.
im not sure do i have to implement those tabs manually? or is there any hope?
thanks a lot!
Art
--------
http://artur.ejsmont.org