如何在drupal中添加模块链接到主菜单?

时间:2012-08-29 18:26:32

标签: drupal

如何在主页选项卡旁边的drupal 7/8中添加模块链接到主菜单?这是我的代码

    <?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;

}

1 个答案:

答案 0 :(得分:2)

您只需要设置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'
);

有关详细信息,请参阅hook_menu()文档。