user2150083
user2150083

Reputation:

Drupal 7 - Add tab link to Node Edit Form

Developing a module for Drupal 7 I can't seem to find how to add a link to neither the horizontal or the vertical tab when editing a node. I'm pretty sure I have to use hook_menu_alter but still...

menu 1

menu 2

Upvotes: 1

Views: 2098

Answers (1)

Brock Boland
Brock Boland

Reputation: 16640

You don't need to use hook_menu_alter, you can just use hook_menu to define the new path:

/**
 * Implements hook_menu().
 */
function mymodule_global_menu() {
  $items['node/%/some_action'] = array(
    'title' => 'This Is A new Tab',
    'page callback' => 'mymodule_some_action_tab',
    'access arguments' => array('access content'),
    'type' => MENU_LOCAL_TASK,
  );
  return $items;
}

Replace some_action with the actual sub path you want to use, and mymodule_some_action_tab with the actual callback function for the tab.

Upvotes: 2

Related Questions