[BUGFIX] setRespectSysLanguage(FALSE) doesn't prevent language overlay 22/22422/2
authorStanislas Rolland <typo3@sjbr.ca>
Mon, 10 Jun 2013 15:25:00 +0000 (11:25 -0400)
committerStanislas Rolland <typo3@sjbr.ca>
Fri, 19 Jul 2013 14:41:06 +0000 (16:41 +0200)
Solution: When this flag is set to FALSE, do not apply language
overlays.

Resolves: #47192
Releases: 6.0, 6.1, 6.2
Change-Id: Iac0d647fde2f930a63bc6982472b1c76e649601d
Reviewed-on: https://review.typo3.org/22422
Reviewed-by: Stanislas Rolland
Tested-by: Stanislas Rolland
typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbBackend.php

index 617a693..80af3ac 100644 (file)
@@ -1114,7 +1114,8 @@ class Typo3DbBackend implements \TYPO3\CMS\Extbase\Persistence\Generic\Storage\B
                        $overlayedRows = array();
                        foreach ($rows as $row) {
                                // If current row is a translation select its parent
-                               if (isset($tableName) && isset($GLOBALS['TCA'][$tableName])
+                               if ($querySettings->getRespectSysLanguage()
+                                       && isset($tableName) && isset($GLOBALS['TCA'][$tableName])
                                        && isset($GLOBALS['TCA'][$tableName]['ctrl']['languageField'])
                                        && isset($GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField'])
                                ) {
@@ -1133,14 +1134,16 @@ class Typo3DbBackend implements \TYPO3\CMS\Extbase\Persistence\Generic\Storage\B
                                if ($pageRepository->versioningPreview && isset($row['_ORIG_uid'])) {
                                        $row['uid'] = $row['_ORIG_uid'];
                                }
-                               if ($tableName == 'pages') {
-                                       $row = $pageRepository->getPageOverlay($row, $querySettings->getSysLanguageUid());
-                               } elseif (isset($GLOBALS['TCA'][$tableName]['ctrl']['languageField'])
-                                       && $GLOBALS['TCA'][$tableName]['ctrl']['languageField'] !== ''
-                               ) {
-                                       if (in_array($row[$GLOBALS['TCA'][$tableName]['ctrl']['languageField']], array(-1, 0))) {
-                                               $overlayMode = $languageMode === 'strict' ? 'hideNonTranslated' : '';
-                                               $row = $pageRepository->getRecordOverlay($tableName, $row, $querySettings->getSysLanguageUid(), $overlayMode);
+                               if ($querySettings->getRespectSysLanguage()) {
+                                       if ($tableName == 'pages') {
+                                               $row = $pageRepository->getPageOverlay($row, $querySettings->getSysLanguageUid());
+                                       } elseif (isset($GLOBALS['TCA'][$tableName]['ctrl']['languageField'])
+                                               && $GLOBALS['TCA'][$tableName]['ctrl']['languageField'] !== ''
+                                       ) {
+                                               if (in_array($row[$GLOBALS['TCA'][$tableName]['ctrl']['languageField']], array(-1, 0))) {
+                                                       $overlayMode = $languageMode === 'strict' ? 'hideNonTranslated' : '';
+                                                       $row = $pageRepository->getRecordOverlay($tableName, $row, $querySettings->getSysLanguageUid(), $overlayMode);
+                                               }
                                        }
                                }
                                if ($row !== NULL && is_array($row)) {