Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trouble getting a nested menu item to show up in Drupal 7 module

I have a tab which I attach to nodes; it works just fine.

I have a sub-tab which I want to place beneath that tab. It does not show up.

Here is my menu definition related to the problem:

// Parent tab, attached to nodes.
$items['node/%node/layout'] = array(
'title' => 'Parent tab',
'description' => 'tab that is attached to the node, same level as edit tab',
'page callback' => 'my_callback',
'page arguments' => array(1),
'access callback' => true, // To test.
'type' => MENU_LOCAL_TASK,
'weight' => 200,
'file' => 'mymodule.admin.inc',
);
// Child tab, beneath parent tab.
$items['node/%node/layout/fields'] = array(
'parent' => 'node/%/layout',
'title' => 'child tab',
'description' => 'child tab, underneath parent tab',
'page callback' => 'my_child_callback',
'page arguments' => array(1),
'access callback' => true, // To test.
'type' => MENU_LOCAL_TASK,
'file' => 'mymodule.admin.inc',
);

Thanks in advance for any help you might offer.

like image 265
Ted Avatar asked Nov 27 '25 16:11

Ted


1 Answers

As @Clive pointed out in a comment to my question: MENU_LOCAL_TASK requires at least two items.

like image 90
Ted Avatar answered Nov 30 '25 07:11

Ted



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!