admin / content / myModule下的菜单结构

时间:2011-03-25 11:26:10

标签: php drupal drupal-6 module drupal-modules

我创建了一个带有块的基本模块(我喜欢node_import)。现在我想在(admin / content / myModule)的设置页面中链接节点导入,myModule是我创建的模块。在此我想要一个也与node_import的链接。已经阅读了很多,但没有找到教程来做到这一点。

1 个答案:

答案 0 :(得分:0)

有几种方法可以做到这一点

在mymodule_menu中

添加:


  $items['admin/content/myModule/node_import'] = array(
    'title'                => 'Node Import', // this is the title that appears in the menu
    'page callback'        => 'drupal_goto', // this is the function that will be called
    'page arguments'       => array('admin/content/node_import'), // whatever the path is you want Drupal to forward the user to
    'access arguments'     => array('access content'), // whatever permission you want the user to have to see this menu item
  );

上述解决方案添加了一个菜单项,用于将用户转发(HTTP重定向)到原始菜单项。根据我的经验,这是添加将用户转发到其他菜单项的菜单项的最简单,最安全的方法。

另一种选择是使用node_import_menu定义的相同“页面回调”和“页面参数”。您遇到的问题是,有时这些函数会将行为基于页面路径,因为页面路径会有所不同,而且函数行为会发生变化。