[BUGFIX] Fix rootline translation
[Packages/TYPO3.CMS.git] / typo3 / sysext / frontend / Classes / Controller / TypoScriptFrontendController.php
index 08226ba..c6a2839 100644 (file)
@@ -2580,13 +2580,7 @@ class TypoScriptFrontendController {
                        \TYPO3\CMS\Core\Utility\GeneralUtility::sysLog($message, 'cms', \TYPO3\CMS\Core\Utility\GeneralUtility::SYSLOG_SEVERITY_ERROR);
                        $this->pageNotFoundAndExit($message);
                }
-               // Updating content of the two rootLines IF the language key is set!
-               if ($this->sys_language_uid && is_array($this->tmpl->rootLine)) {
-                       $this->tmpl->rootLine = $this->sys_page->getRootLine($this->id, $this->MP);
-               }
-               if ($this->sys_language_uid && is_array($this->rootLine)) {
-                       $this->rootLine = $this->sys_page->getRootLine($this->id, $this->MP);
-               }
+               $this->updateRootLinesWithTranslations();
                // Finding the ISO code:
                if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('static_info_tables') && $this->sys_language_content) {
                        // using sys_language_content because the ISO code only (currently) affect content selection from FlexForms - which should follow "sys_language_content"
@@ -2616,6 +2610,18 @@ class TypoScriptFrontendController {
                }
        }
 
+       /**
+        * Updating content of the two rootLines IF the language key is set!
+        */
+       protected function updateRootLinesWithTranslations() {
+               if ($this->sys_language_uid && is_array($this->tmpl->rootLine)) {
+                       $this->tmpl->rootLine = array_reverse($this->sys_page->getRootLine($this->id, $this->MP));
+               }
+               if ($this->sys_language_uid && is_array($this->rootLine)) {
+                       $this->rootLine = $this->sys_page->getRootLine($this->id, $this->MP);
+               }
+       }
+
        /**
         * Setting locale for frontend rendering
         *
@@ -4760,5 +4766,4 @@ if (version == "n3") {
 
 }
 
-
-?>
+?>
\ No newline at end of file