I would like to add several sub-nav menu items underneath the node default "view" and "edit". I suspect the defined URL path is the problem. For instance the URL path of "view" is "node/[nid]" and "edit" is "node/[nid]/edit". The trick seems to be adding the current node value dynamically to the URL path like this:

$items[] = array('path' => 'node/' . $node->nid . '/list_appointment',
'title' => t('list appointments'),
'callback' => 'case_appointment_list',
'access' => user_access('list appointments'),
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10);

Only the above doesn't work because it's predefined and hock_menu() lacks the node object.

Can someone set me straight? Thanks!

Comments

johnhanley’s picture

Due to persistance and determination I am responding and answering my own post yet again.

The solution is to use define non-cache menu items. See mode.module for an example. For instance

if (arg(0) == 'node' && is_numeric(arg(1))) {
$node = node_load(array('nid' => arg(1)));
if ($node->nid) {
$items[] = array('path' => 'node/' . $node>nid . '/appointment/list', 'title' => t('appointment list'), 'callback' => 'case_appointment_list', 'callback arguments' => $node->nid, 'access' => node_access('appointment list', $node), 'type' => MENU_LOCAL_TASK, 'weight' => -10);
}
}

Hope this helps someone else wandering around in the desert that is Drupal.