gpt4 book ai didi

php - drupal 7 hook_menu()不工作

转载 作者:行者123 更新时间:2023-12-02 07:44:10 25 4
gpt4 key购买 nike

我正在尝试向主页>管理>配置页面添加一个部分,然后打开一个包含 2 个选项卡(create_team 和 create_game)的新表单。

我的代码(不起作用):

function guild_management_core_menu()
{
$items['admin/config/guild_management_core/create_game'] = array
(
'title' => 'Create Game',
'description' => 'Create Game',
'page callback' => 'drupal_get_form',
'page arguments' => array('guild_management_core_create_game'),
'access arguments' => array('access administration pages'),
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => 0,
);
$items['admin/config/guild_management_core/create_team'] = array
(
'title' => 'Create Team',
'description' => 'Create Team',
'page callback' => 'drupal_get_form',
'page arguments' => array('guild_management_core_create_team'),
'access arguments' => array('access administration pages'),
'type' => MENU_LOCAL_TASK,
'weight' => 0,
);

return $items;

我尝试了下面的链接,但它们也不起作用: drupal--hook_menu Drupal hook_menu from module for admin menu

我也禁用了该模块并再次启用它,然后我清除了缓存,但仍然没有结果。

编辑:这有效:

$items['admin/config/annotate'] = array(
'title' => 'Guild Management',
'description' => 'Guild Management',
'position' => 'right',
'weight' => -5,
'page callback' => 'system_admin_menu_block_page',
'access arguments' => array('administer site configuration'),
'file' => 'system.admin.inc',
'file path' => drupal_get_path('module', 'system'),
);

当我用“admin/config/guild_management_core”替换“admin/config/annotate”时,它又出错了...

最佳答案

已更新

这应该适合你:

function tbff_promo_menu() {
$items['admin/config/guild_management'] = array(
'title' => 'Create Game',
'description' => 'Create Game.',
'position' => 'right',
'weight' => -20,
'page callback' => 'system_admin_menu_block_page',
'access arguments' => array('access administration pages'),
'file' => 'system.admin.inc',
);
$items['admin/config/guild_management/core'] = array(
'title' => 'Create Game',
'description' => 'Create Game',
'page callback' => 'drupal_get_form',
'page arguments' => array('search_block_form'),
'access arguments' => array('access administration pages'),
'type' => MENU_NORMAL_ITEM
);
$items['admin/config/guild_management/core/create_game'] = array(
'title' => 'Create Game',
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => 0
);
$items['admin/config/guild_management/core/create_team'] = array(
'title' => 'Create Team',
'description' => 'Create Team',
'page callback' => 'drupal_get_form',
'page arguments' => array('search_block_form'),
'access arguments' => array('access administration pages'),
'type' => MENU_LOCAL_TASK,
'weight' => 0,
);
return $items;
}

关于php - drupal 7 hook_menu()不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8259081/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com