Pedro Posada | Setting up MENU_LOCAL_TASK for secondary tabs

Setting up MENU_LOCAL_TASK for secondary tabs

Posted on March 27, 2009 - 1:02pm
<< 22 of 54 >>

How to create secondary local tasks or secondary tabs, also called sub tab (second level) menu items.

It was not clear to me why it was necessary to create a MENU_DEFAULT_LOCAL_TASK in every tab level. In order to tell drupal's menu system to show primary and secondary local tasks, there is a need to create a default local task every time. The default local task points to the same page as the parent item but has a path longer by one element.

Parent path:
'admin'

Default primary local task path:
'admin/home'

Default secondary local task path:
'admin/home/home'

All three menu items go to 'admin' and all three show 'admin' on the address bar. Both local tasks can share the same page callbacks.

The code inside your hook_menu() would look something like this.

$items['cart/admin'] = array(
    'title' => 'Cart Administration',
    'page callback' => 'cart_admin_home_page',
    'access arguments' => array('access cart admin pages'),
  );
 
$items['cart/admin/home'] = array(
    'title' => 'Admin\'s Home',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -10,
  );
 
$items['cart/admin/home/home'] = array(
    'title' => 'Admin\'s Home',
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );

Check out the following link to understand how to set up secondary tabs or secondary local tasks. This took me several hours to find and understand.

http://drupal.org/node/110773#comment-245960

Submitted by Nelson (not verified) on March 4, 2011 - 2:06am.

There are many data storage types that are used to store information and acts as memory devices due to its rapidly advancing technologies used nowadays. Read on to enrich your knowledge about computer storage devices (RAM). Related articles are available at www.mgupload.net

Nelson
www.mgupload.net

Submitted by InfoTech (not verified) on March 28, 2011 - 6:18pm.

You must be aware that you really have an awesome site. Does exactly what it sets out to do. Stimulating me to read much more of your post. Hope to see a lot more excellent posts from you shortly. Keep it up buddy.

Raine
InfoTech
www.shabsoft.net

Submitted by Your online Library (not verified) on September 28, 2011 - 8:44pm.

I’m impressed. Very informative and trustworthy blog does exactly what it sets out to do. I’ll bookmark your weblog for future use.

Joseph
www.joeydavila.com
Your online Library

Post new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Copy the characters (respecting upper/lower case) from the image.