【发布时间】:2011-03-02 16:54:38
【问题描述】:
如何在 Drupal 中创建不会自动呈现导航链接的新路线/菜单?
我正在尝试在 Drupal 中创建一个未显示在导航菜单中的简单页面回调。
我有一个名为 helloworld 的模块。
.module 文件包含以下内容
function _helloword_page_callback()
{
return array('#markup'=>'The quick brown fox says hello, and the lazy dogs thanks you
for following conventions.');
}
function helloworld_menu()
{
$items['helloworld'] = array(
'title' => 'Hello World',
'page callback' => '_helloword_page_callback',
'access arguments' => array('content'),
'type' => MENU_CALLBACK
);
return $items;
}
这成功地暴露了网站上的一个 URL
http://example.drupal.com/helloworld
但是,尽管使用了
,但我仍然在左侧 (Bartik) 导航菜单中看到了一个链接'type' => MENU_CALLBACK
那么,为什么这不起作用?我是否正确配置了菜单项?一个更可能的问题:我如何误解菜单类型常量/系统的使用?是否有额外的缓存来清除它
drush cc all
不会照顾?我还可以采取哪些其他步骤来调试它?
【问题讨论】:
标签: drupal drupal-7 drupal-routes