第一个模块的例程的最后一步是建立一个node annotation菜单,并且把annotation settings嵌套到他底下。
但是我按照书上的例子做了以后,结果发现annotation settings并没有嵌套到node annotation下。而是并列和node annotation在admin菜单地下。成了:
Administer
--Node annotation
--Annotation settings
这是咋回事啊。。谢谢。。下面是我的代码:
/**
* Implementation of hook_menu()
*/
function annotate_menu() {
$items[ 'admin/annotate' ] = array(
'title' => 'Node annotation',
'description' => 'Adjust node annotation options.',
'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' ),
);
$items[ 'admin/annotate/settings' ] = array(
'title' => 'Annotation settings',
'description' => 'Change how annotations behave.',
'page callback' => 'drupal_get_form',
'page arguments' => array( 'annotate_admin_settings' ),
'access arguments' => array( 'administer site configuration' ),
'type' => MENU_NORMAL_ITEM,
'file' => 'annotate.admin.inc'
);
return $items;
}
估计还是缓存的原因,Drupal菜单缓存
按照书中提示的清除菜单缓存,就可以了.我的代码为:
function annotate_menu() {
$items[ 'admin/annotate' ] = array(
'title' => 'Node annotation',
'description' => 'Adjust node annotation options.',
'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' ),
);
$items['admin/annotate/settings'] = array(
'title' => 'Annotation settings',
'description' => 'Change how annotations behave',
'page callback' => 'drupal_get_form',
'page arguments' => array('annotate_admin_settings'),
'access arguments' => array('administer site configuration'),
'type' => MENU_NORMAL_ITEM,
'file' => 'annotate.admin.inc',
);
return $items;
}
和你的一样,就有了效果.嵌套的效果.
估计还不是。我清了好几遍缓存还装了dev
估计还不是。我清了好几遍缓存还装了dev 模块用了rebuild menu和reinstall annotation的功能都不行。我再看看。这个有没有什么好的调试工具?
新装了一个drupal然后把文件在考到里面就没问题了。。我
新装了一个drupal然后把文件在考到里面就没问题了。。我估计是不是和那个数据库中的menu_router表有关。
这个就是和菜单的缓存有关
这个就是和菜单的缓存有关,就是menu_router表还有另一个表,有时候问题很奇怪会,慢慢的这样的问题会越来越少.