I want to add some tabs on the page "node /% / edit" from my module called "cssswitch". When I click Rebuild Menu, two new tabs are displayed, but they are displayed for ALL nodes when editing them, and not just for node "cssswitch". I want these new tabs to appear only when editing a node like "cssswitch".
Another problem is when I clear the entire cache, the tabs completely disappear from all the editing pages. Below is the code I wrote.
function cssswitch_menu_alter(&$items) {
$node = menu_get_object();
if ($node->type == 'cssswitch') {
$items['node/%/edit/schedulenew'] = array(
'title' => 'Schedule1',
'access callback'=>'user_access',
'access arguments'=>array('view cssswitch'),
'page callback' => 'cssswitch_schedule',
'page arguments' => array(1),
'type' => MENU_LOCAL_TASK,
'weight'=>4,
);
$items['node/%/edit/schedulenew2'] = array(
'title' => 'Schedule2',
'access callback'=>'user_access',
'access arguments'=>array('view cssswitch'),
'page callback' => 'cssswitch_test2',
'page arguments' => array(1),
'type' => MENU_LOCAL_TASK,
'weight'=>3,
);
}
}
function cssswitch_test(){
return 'test';
}
function cssswitch_test2(){
return 'test2';
}
Thanks for any help.
EricP source
share