将子项添加到第二级 [英] Add subitem to second level

查看:125
本文介绍了将子项添加到第二级的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经手动创建了主链接。是节点的链接(内容类型页面)
喜欢

 
- 关于
- 关于我们
- 关于公司

我需要添加子项关于/关于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 company

I 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.

这篇关于将子项添加到第二级的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆