Bug #65662
closedhideIfNotTranslated expects integer 2 instead of 1 as TRUE value
0%
Description
When using two different default language configurations (for two separate trees) there is a problem with handling of sys_language_mode.
In typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php > settingLanguage #2725 the Method >page['l18n_cfg']) is used to differentiate between exit directly or handle with sys_language_mode.
GeneralUtility::hideIfNotTranslated($this
The method is filled with l18n_cfg column from pages table. This can be 0 or 1.
In both cases it will return FALSE. It can only return TRUE if value 2 is set.
In the backend it's not possible to set this value to 2.
(This may be reversed with $GLOBALS['TYPO3_CONF_VARS']['FE']['hidePagesIfNotTranslatedByDefault'])
if (GeneralUtility::hideIfNotTranslated($this->page['l18n_cfg'])) {
$this->pageNotFoundAndExit('Page is not available in the requested language.');
} else {
switch ((string) $this->sys_language_mode) {
case 'strict':
...
break;
case 'content_fallback':
...
break;
case 'ignore':
...
break;
default:
...
}
}
I think the Method hideIfNotTranslated has to be changed to work with 0 or 1.
Maybe like this:
static public function hideIfNotTranslated($l18n_cfg_fieldValue) {
if ($GLOBALS['TYPO3_CONF_VARS']['FE']['hidePagesIfNotTranslatedByDefault']) {
return $l18n_cfg_fieldValue ? FALSE : TRUE;
} else {
return $l18n_cfg_fieldValue ? TRUE : FALSE;
}
}