Project

General

Profile

Actions

Bug #65662

closed

hideIfNotTranslated expects integer 2 instead of 1 as TRUE value

Added by Bernd Niehues over 9 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Frontend
Target version:
-
Start date:
2015-03-11
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
5.4
Tags:
Complexity:
easy
Is Regression:
No
Sprint Focus:

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
GeneralUtility::hideIfNotTranslated($this
>page['l18n_cfg']) is used to differentiate between exit directly or handle with sys_language_mode.

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;
}
}

Actions

Also available in: Atom PDF