From 1b37fb72977a36ffb1bbb96cb910b56a8d2e7f5a Mon Sep 17 00:00:00 2001
From: Helmut Hummel <typo3@helhum.io>
Date: Tue, 5 Mar 2019 16:03:34 +0100
Subject: [PATCH] [BUGFIX] Allow adding content without page edit permissions

Resolves: #87687
Releases: master, 9.5
Change-Id: I8113f3fa2facf6b21bc19ee1c445265c5ff4f4b4
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/59872
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Tobi Kretschmann <tobi@tobishome.de>
Tested-by: Steffen Frese <steffenf14@gmail.com>
Reviewed-by: Steffen Frese <steffenf14@gmail.com>
Reviewed-by: Susanne Moog <look@susi.dev>
Reviewed-by: Tobi Kretschmann <tobi@tobishome.de>
---
 typo3/sysext/backend/Classes/View/PageLayoutView.php | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/typo3/sysext/backend/Classes/View/PageLayoutView.php b/typo3/sysext/backend/Classes/View/PageLayoutView.php
index cf87a959c446..df64782a0ebf 100644
--- a/typo3/sysext/backend/Classes/View/PageLayoutView.php
+++ b/typo3/sysext/backend/Classes/View/PageLayoutView.php
@@ -841,6 +841,7 @@ class PageLayoutView implements LoggerAwareInterface
         $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/LayoutModule/DragDrop');
         $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/Modal');
         $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/LayoutModule/Paste');
+        $pageActionsCallback = '';
         if ($this->isPageEditable()) {
             $languageOverlayId = 0;
             $pageLocalizationRecord = BackendUtility::getRecordLocalization('pages', $this->id, (int)$this->tt_contentConfig['sys_language_uid']);
@@ -850,11 +851,12 @@ class PageLayoutView implements LoggerAwareInterface
             if (!empty($pageLocalizationRecord['uid'])) {
                 $languageOverlayId = $pageLocalizationRecord['uid'];
             }
-            $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/PageActions', 'function(PageActions) {
+            $pageActionsCallback = 'function(PageActions) {
                 PageActions.setPageId(' . (int)$this->id . ');
                 PageActions.setLanguageOverlayId(' . $languageOverlayId . ');
-            }');
+            }';
         }
+        $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/PageActions', $pageActionsCallback);
         // Get labels for CTypes and tt_content element fields in general:
         $this->CType_labels = [];
         foreach ($GLOBALS['TCA']['tt_content']['columns']['CType']['config']['items'] as $val) {
-- 
GitLab