我需要添加子项关于/关于company / company1 和关于/关于公司/公司2 从我的模块。
下一行在第一级创建菜单项(在一个级别与 - 关于)
$ items ['about2 '] = array('menu_name'=>'primary-links','title'=>'About2','page callback'=>'ninegm_about2' 'access callback'=> TRUE,'weight'=> -10,);解决方案
查看 Drupal API 网站。菜单项和分层组织的路径由您定义新菜单项时传递给$项的键决定。现在你正在制作一个全新的顶级菜单项。
所以你需要用一些类似的东西代替 $ items ['about2']这是:
$ items ['关于/关于公司/约2'] =数组( //菜单项定义的其余部分...这将使新菜单项在其路径中的菜单项的子项,所以它会出来看起来像这样:
- 关于
- 关于公司
---关于2
这是假设你的根目录的路径是关于页面是关于,你的关于公司页面的路径是关于公司,如果不是这样,只需将它们替换成这些页面的真实路径。
I have primary links created manually. The are links to node (content type 'page') like
-About --About Us --About companyI need to add subitems About/About company/company1 and About/About company/company2 from my module.
Next lines create menu item in first level (in one level with -About)
$items['about2'] = array( 'menu_name' => 'primary-links', 'title' => 'About2', 'page callback' => 'ninegm_about2', 'access callback' => TRUE, 'weight' => -10, );解决方案
Check out the documentation at the Drupal API site. The path of the menu item, and the hierarchical organization, is determined by the key you pass to $items when defining a new menu item. Right now you are making a completely new top-level menu item.
So you need to replace $items['about2'] with something like this:
$items['About/About company/about2'] = array( //rest of menu item definition . . .This will make the new menu item a child of the menu items in its path, so it will come out looking like this:
-About
--About Company
---About2
This is assuming the path to your root about page is "About", and the path to your About Company page is "About company". If that isn't true, just replace them with the real paths to those pages.
更多推荐
将子项添加到第二级
发布评论