Reputation: 181
How to add a module link to main menu, beside the home tab, in drupal 7/8? here is my code
<?php
function api_manager_menu() {
$items = array();
$items['api_manager'] = array(
'title' => 'API Manager',
'description' => 'Manage the lifecycle of an API',
'page callback' => 'drupal_get_form',
'page arguments' => array('api_manager_form'),
'access arguments' => user_access('administer users'),
'type' => MENU_NORMAL_ITEM
);
return $items;
}
Upvotes: 1
Views: 1729
Reputation: 36956
You just need to set the menu_name
:
$items['api_manager'] = array(
'title' => 'API Manager',
'description' => 'Manage the lifecycle of an API',
'page callback' => 'drupal_get_form',
'page arguments' => array('api_manager_form'),
'access arguments' => user_access('administer users'),
'type' => MENU_NORMAL_ITEM,
'menu_name' => 'primary-links'
);
See the hook_menu() docs for more information.
Upvotes: 2