[BUGFIX] setRespectSysLanguage(FALSE) doesn't prevent language overlay 22/21322/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 03:31:48 +0000 (05:31 +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/21322
Reviewed-by: Georg Ringer
Tested-by: Georg Ringer
Reviewed-by: Paul Dubuc
Tested-by: Paul Dubuc
Reviewed-by: Stanislas Rolland
Tested-by: Stanislas Rolland
typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbBackend.php

index 1d1d0e0..c55279c 100644 (file)
@@ -1149,7 +1149,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'])
                                ) {
@@ -1168,14 +1169,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)) {
@@ -1272,4 +1275,4 @@ class Typo3DbBackend implements \TYPO3\CMS\Extbase\Persistence\Generic\Storage\B
        }
 }
 
-?>
\ No newline at end of file
+?>