[TASK] Respect alternative web mounts in suggest wizard
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Classes / Authentication / BackendUserAuthentication.php
index 2aee84a..40970d7 100644 (file)
@@ -1322,6 +1322,34 @@ class BackendUserAuthentication extends AbstractUserAuthentication
         $this->groupData['webmounts'] = implode(',', array_unique($mountPointUids));
     }
 
+    /**
+     * Checks for alternative web mount points for the element browser.
+     *
+     * If there is a temporary mount point active in the page tree it will be used.
+     *
+     * If the User TSconfig options.pageTree.altElementBrowserMountPoints is not empty the pages configured
+     * there are used as web mounts If options.pageTree.altElementBrowserMountPoints.append is enabled,
+     * they are appended to the existing webmounts.
+     *
+     * @internal - do not use in your own extension
+     */
+    public function initializeWebmountsForElementBrowser()
+    {
+        $alternativeWebmountPoint = (int)$this->getSessionData('pageTree_temporaryMountPoint');
+        if ($alternativeWebmountPoint) {
+            $alternativeWebmountPoint = GeneralUtility::intExplode(',', $alternativeWebmountPoint);
+            $this->setWebmounts($alternativeWebmountPoint);
+            return;
+        }
+
+        $alternativeWebmountPoints = trim($this->getTSConfig()['options.']['pageTree.']['altElementBrowserMountPoints'] ?? '');
+        $appendAlternativeWebmountPoints = $this->getTSConfig()['options.']['pageTree.']['altElementBrowserMountPoints.']['append'] ?? '';
+        if ($alternativeWebmountPoints) {
+            $alternativeWebmountPoints = GeneralUtility::intExplode(',', $alternativeWebmountPoints);
+            $this->setWebmounts($alternativeWebmountPoints, $appendAlternativeWebmountPoints);
+        }
+    }
+
     /**
      * Returns TRUE or FALSE, depending if an alert popup (a javascript confirmation) should be shown
      * call like $GLOBALS['BE_USER']->jsConfirmation($BITMASK).