how to show tabs when subtab selected

ptalindstrom - March 28, 2008 - 17:00

I have a "framework" module which has a primary tab added to node pages (alongside edit, view, etc) and a default secondary tab below this. It also supports plugin modules which each will add a secondary tab.

this is what I have now:

in my main module (some conditional stuff pulled out) - all $items under !may_cacce

$items[] = array('path' => 'node/'. arg(1) .'/auth',
'title' => t('Authenticate'),
'callback' => '_auth_landing',
'access' => user_access('authenticate documents'),
'type' => MENU_LOCAL_TASK,
'weight' => 10,
);
$items[] = array(
'path' => 'node/'. arg(1) .'/auth/general',
'title' => t('General'),
//'callback' => '_auth_landing',
'access' => user_access('authenticate documents'),
'type' => MENU_DEFAULT_LOCAL_TASK,
);

if this is all there is then the General subtab doesn’t show (since Drupal requires there to be 2 tabs before it will show tabs at that level); but its contents is _auth_landing as on parent tab – which is cool.

now in plugin api modules like yahoo_auth.module I have:

if (variable_get('authenticate_'. $node->type, 0)) {
$items[] = array(
'path' => 'node/'. arg(1) .'/auth/yahoo',
'title' => t('Yahoo'),
'callback' => 'yahoo_auth_submit',
'access' => user_access('authenticate documents'),
'type' => MENU_LOCAL_TASK,
);

and I now get my subtabs when i am at node/1708/auth .. very sweet.

BUT… when I go to a subtab node/1708/auth/yahoo I lose all my tabs .. not so sweet.

any ideas?

 
 

Drupal is a registered trademark of Dries Buytaert.