And another Drupal tip for today: "How to add a tab to the node in Drupal":
Put this snippet in hook_menu of your new module:
$items['node/%node/new_tab'] = array(
'title' => 'New Tab',
'page callback' => 'mycallback',
'page arguments' => array(1),
'access callback' => TRUE,
'type' => MENU_LOCAL_TASK
)
This tab is going to be shown on any node type and without access restrictions,
however, if you need to specify a special node type, 'custom_node' for example, do the following:
put this snippet in hook_menu of your new module:
$items['node/%custom_node/new_tab'] = array(
'title' => 'New Tab',
'page callback' => 'mycallback',
'page arguments' => array(1),
'access callback' => TRUE,
'type' => MENU_LOCAL_TASK
)
And create a function:
function custom_node_load($arg) {
$node = node_load($arg);
if($node->type == 'custom_node')
return $node;
return FALSE;
}
Hope this helps!
Posted in Drupal, February 11th, 2010
Tags: drupal, drupal planet
Ok I found the problem. I
By teemak (not verified)Ok I found the problem. I can't put the pathauto directly in the URL.... Thx
Hello! Thanks but I've a
By teemak (not verified)Hello!
Thanks but I've a problem with it... it doesn't work!
Maybe there is a conflict with pathauto?
Post new comment