我用以下的typoscript构建我的菜单
includeLibs.myadminmenu = typo3conf/ext/my_admin/user_makemenu.php
lib.userMenu = COA_INT
lib.userMenu.10 = HMENU
lib.userMenu.10 {
special = directory
special.value = 184
modules = {$modules}
entryLevel = 1
1 = TMENU
1.itemArrayProcFunc = user_myadminmenu->makemenu
1 {
NO = 1
NO.allWrap = |
ACT = 1
ACT.allWrap = |
}
}
这很好用,但在我的makemenu方法中我有以下
foreach($menuArr AS $i => $menu) {
if (array_key_exists($menu['uid'], $this->paymentModules)) {
if (! in_array($this->paymentModules[$menu['uid']], $modules)) {
$menuArr[$i]['doNotLinkIt'] = 1;
}
}
}
这不起作用 - 我试过
unset($menuArr[$i])
这删除了菜单项,但我只是想让它不要链接,有没有办法做到这一点?
如果无法取消关联菜单项,是否可以将网址覆盖到其他网页?
答案 0 :(得分:0)
另一种方法可能是:
(未测试的)
includeLibs.myadminmenu = typo3conf/ext/my_admin/user_makemenu.php
lib.userMenu = COA_INT
lib.userMenu.10 = HMENU
lib.userMenu.10 {
special = directory
special.value = 184
modules = {$modules}
entryLevel = 1
1 = TMENU
1 {
NO = 1
NO.allWrap = |
NO.doNotLinkIt = 1
NO.doNotLinkIt.if {
# the userfunc needs to return a list of pids like
# value = 10,12,24,44
value.postUserFunc = user_myadminmenu->makemenu
isInList.field = uid
}
ACT = 1
ACT.allWrap = |
ACT.doNotLinkIt < .NO.doNotLinkIt
}
}
恕我直言,这更容易阅读和维护。