Menu structure under admin/content/myModule
开发者_JAVA技巧I created a basic module with a block (I liked node_import to). Now I want node import also linked in the settings page in (admin/content/myModule), myModule is the module that I created. Under this I want a link also to node_import. Has read a lot, but not find the tutorial to do that.
there are a couple of ways to do this
in mymodule_menu add this:
$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
);
The above solution adds a menu item that forwards (HTTP redirect) the user to the original menu item. In my experience this is the easiest and safest way to add menu items forwarding users to other menu items.
The other option would be to use the same 'page callback' and 'page arguments' that node_import_menu defines. The problem you have with this is that sometimes these functions will base the behavior on the page path and since the page path would be different and the function behavior changes.
精彩评论