页脚菜单定义如下:
temp.footerNav = HMENU
temp.footerNav {
special = userfunction
special.userFunc = \MyNamespace\Helper->footerNavArray
wrap = <ul>|</ul>
1 = TMENU
1 {
wrap = |
expAll = 0
NO = 1
NO.ATagParams = class="footer-navigation-link"
NO.stdWrap.htmlSpecialChars = 1
NO.wrapItemAndSub = <li class="footer-navigation__item">|</li>
NO.stdWrap.field = title // nav_title
}
}
函数footerNavArray
返回的数组在德语
array (size=7)
0 =>
array (size=2)
'title' => string 'Unternehmen' (length=11)
'_OVERRIDE_HREF' => string 'de/unternehmen.html' (length=19)
...
...
和英语:
array (size=7)
0 =>
array (size=2)
'title' => string 'Company' (length=7)
'_OVERRIDE_HREF' => string 'en/company.html' (length=15)
...
...
页脚菜单以英语(默认语言)完美运行,但是,我在德语页面(L = 1)上看到的唯一输出是<ul></ul>
。
有什么想法吗?
答案 0 :(得分:4)
首先,上述行为是由[FE][hidePagesIfNotTranslatedByDefault] = 1
引起的,Solr for TYPO3要求它在多语言网站中正常运行。通过将'_SAFE' = true
添加到菜单数组,我终于能够解决问题:
array (size=7)
0 =>
array (size=3)
'title' => string 'Company' (length=7)
'_OVERRIDE_HREF' => string 'en/company.html' (length=15)
'_SAFE' => boolean true
...
...
我在TYPO3\CMS\Frontend\ContentObject\Menu\AbstractMenuContentObject->filterMenuPages()
的第1213行(核心版本7.6.2)中找到了解决方案:
答案 1 :(得分:0)
您还可以将全局环境条件用于不同的语言。
#setup the default language in case of bad L variable
config.sys_language_mode = content_fallback
config.uniqueLinkVars=1
config.sys_language_overlay = 1
config.sys_language_uid = 0
config.language = en
config.linkVars = L
# Spanish language, sys_language.uid = 1
[globalVar = GP:L = 1]
config.sys_language_uid = 1
config.language = es
config.locale_all = spanish
[global]
# English language, sys_language.uid = 0
[globalVar = GP:L = 0]
config.sys_language_uid = 0
config.language = en
[global]