[BUGFIX] Let Web-View respect TCEMAIN.previewDomain 10/32510/5
authorGeorg K├╝hnberger <gk@plan2.net>
Wed, 27 Aug 2014 14:04:31 +0000 (16:04 +0200)
committerMarkus Klein <klein.t3@reelworx.at>
Fri, 29 Aug 2014 12:29:09 +0000 (14:29 +0200)
Added previewDomain in order to have Web-View functioning in the
same way like Page-Preview does.

Fixes: #61226
Related: #30889
Releases: 6.3, 6.2
Change-Id: I872651aeac1bda27f7a8a034fc30a21ff7162df0
Reviewed-on: http://review.typo3.org/32510
Reviewed-by: Oliver Gassner <og@plan2.net>
Tested-by: Oliver Gassner <og@plan2.net>
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>
typo3/sysext/backend/Classes/Utility/BackendUtility.php
typo3/sysext/viewpage/Classes/Controller/ViewModuleController.php

index 76e55bd..37268d8 100644 (file)
@@ -3432,7 +3432,7 @@ class BackendUtility {
         * Returns first found domain record "domainName" (without trailing slash) if found in the input $rootLine
         *
         * @param array $rootLine Root line array
-        * @return string Domain name, if found.
+        * @return string|NULL Domain name or NULL
         */
        static public function firstDomainRecord($rootLine) {
                foreach ($rootLine as $row) {
@@ -3442,6 +3442,7 @@ class BackendUtility {
                                return rtrim($dRecord['domainName'], '/');
                        }
                }
+               return NULL;
        }
 
        /**
index f193389..488f232 100644 (file)
@@ -122,10 +122,15 @@ class ViewModuleController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionContr
         * Get domain name for requested page id
         *
         * @param integer $pageId
-        * @return boolean|string Domain name if there is one, FALSE if not
+        * @return string|NULL Domain name from first sys_domains-Record or from TCEMAIN.previewDomain, NULL if neither is configured
         */
        protected function getDomainName($pageId) {
-               $domain = BackendUtility::firstDomainRecord(BackendUtility::BEgetRootLine($pageId));
+               $previewDomainConfig = $GLOBALS['BE_USER']->getTSConfig('TCEMAIN.previewDomain', BackendUtility::getPagesTSconfig($pageId));
+               if ($previewDomainConfig['value']) {
+                       $domain = $previewDomainConfig['value'];
+               } else {
+                       $domain = BackendUtility::firstDomainRecord(BackendUtility::BEgetRootLine($pageId));
+               }
                return $domain;
        }