From a8b8b7a4796ca2fcdfa2b5f195dc2a27ca0df998 Mon Sep 17 00:00:00 2001
From: Claus Due <claus@namelesscoder.net>
Date: Sun, 23 Feb 2020 11:35:43 +0100
Subject: [PATCH] [BUGFIX] Fix page module button label and undefined variable
 access
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Fixes a couple of issues:

* Missing button text for "new content" button
* Two cases of access to undefined variables
* Add missing f:format.raw in record footer
* Add missing paste-after icon

Resolves: #90506
Releases: master
Change-Id: I9facb46ecaf6dfb7ebc76a2733a4a8c6e2cb3c93
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/63390
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Kevin Appelt <kevin.appelt@icloud.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Christian Eßl <indy.essl@gmail.com>
Reviewed-by: Oliver Bartsch <bo@cedev.de>
Reviewed-by: Kevin Appelt <kevin.appelt@icloud.com>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
---
 .../Classes/View/BackendLayout/BackendLayout.php       |  3 ++-
 .../Classes/View/BackendLayout/Grid/GridColumnItem.php |  2 +-
 .../Private/Partials/PageLayout/Grid/Column.html       |  2 +-
 .../Resources/Private/Partials/PageLayout/Record.html  | 10 ++++++----
 .../Private/Partials/PageLayout/Record/Footer.html     |  2 +-
 5 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/typo3/sysext/backend/Classes/View/BackendLayout/BackendLayout.php b/typo3/sysext/backend/Classes/View/BackendLayout/BackendLayout.php
index 11ff0b6cd1f2..4bffb76b62f6 100644
--- a/typo3/sysext/backend/Classes/View/BackendLayout/BackendLayout.php
+++ b/typo3/sysext/backend/Classes/View/BackendLayout/BackendLayout.php
@@ -308,7 +308,8 @@ class BackendLayout
             }
             $grid->addRow($rowObject);
         }
-        $allowInconsistentLanguageHandling = (bool)(BackendUtility::getPagesTSconfig($this->id)['mod.']['web_layout.']['allowInconsistentLanguageHandling'] ?? false);
+        $pageId = $this->drawingConfiguration->getPageId();
+        $allowInconsistentLanguageHandling = (bool)(BackendUtility::getPagesTSconfig($pageId)['mod.']['web_layout.']['allowInconsistentLanguageHandling'] ?? false);
         if (!$allowInconsistentLanguageHandling && $this->getLanguageModeIdentifier() === 'connected') {
             $grid->setAllowNewContent(false);
         }
diff --git a/typo3/sysext/backend/Classes/View/BackendLayout/Grid/GridColumnItem.php b/typo3/sysext/backend/Classes/View/BackendLayout/Grid/GridColumnItem.php
index 2358f21441ef..9dc2ad9d568f 100644
--- a/typo3/sysext/backend/Classes/View/BackendLayout/Grid/GridColumnItem.php
+++ b/typo3/sysext/backend/Classes/View/BackendLayout/Grid/GridColumnItem.php
@@ -195,7 +195,7 @@ class GridColumnItem extends AbstractGridObject
     public function isDelible(): bool
     {
         $backendUser = $this->getBackendUser();
-        if (!$backendUser->doesUserHaveAccess($this->pageinfo, Permission::CONTENT_EDIT)) {
+        if (!$backendUser->doesUserHaveAccess($this->backendLayout->getDrawingConfiguration()->getPageRecord(), Permission::CONTENT_EDIT)) {
             return false;
         }
         return !(bool)($backendUser->getTSConfig()['options.']['disableDelete.']['tt_content'] ?? $backendUser->getTSConfig()['options.']['disableDelete'] ?? false);
diff --git a/typo3/sysext/backend/Resources/Private/Partials/PageLayout/Grid/Column.html b/typo3/sysext/backend/Resources/Private/Partials/PageLayout/Grid/Column.html
index f2b104b19ae7..e1935eb681f1 100644
--- a/typo3/sysext/backend/Resources/Private/Partials/PageLayout/Grid/Column.html
+++ b/typo3/sysext/backend/Resources/Private/Partials/PageLayout/Grid/Column.html
@@ -57,7 +57,7 @@
                 {f:if(condition: column.items, else: 't3-page-ce-empty')}">
             <f:for each="{column.items}" as="item">
                 <f:if condition="{item.deletePlaceholder} == 0">
-                    <f:render partial="PageLayout/Record" arguments="{item: item, grid: grid}" />
+                    <f:render partial="PageLayout/Record" arguments="{_all}" />
                 </f:if>
             </f:for>
         </div>
diff --git a/typo3/sysext/backend/Resources/Private/Partials/PageLayout/Record.html b/typo3/sysext/backend/Resources/Private/Partials/PageLayout/Record.html
index 3f13d95723b9..8dc2731d8386 100644
--- a/typo3/sysext/backend/Resources/Private/Partials/PageLayout/Record.html
+++ b/typo3/sysext/backend/Resources/Private/Partials/PageLayout/Record.html
@@ -18,10 +18,12 @@
         </div>
     </div>
     <f:if condition="{item.column.contentEditable} && {grid.allowNewContent}">
-        <a href="{item.newContentAfterUrl}" title="{item.newContentAfterLinkTitle}" data-title="{item.newContentAfterLinkTitle}" class="btn btn-default btn-sm t3js-toggle-new-content-element-wizard">
-            <core:icon identifier="actions-add" />
-            {item.newContentAfterTitle}
-        </a>
+        <div class="t3js-page-new-ce t3-page-ce-wrapper-new-ce" id="colpos-{item.column.columnNumber}-page-{item.column.backendLayout.drawingConfiguration.pageId}-{item.column.uniqueId}">
+            <a href="{item.newContentAfterUrl}" title="{item.newContentAfterLinkTitle}" data-title="{item.newContentAfterLinkTitle}" class="btn btn-default btn-sm t3js-toggle-new-content-element-wizard">
+                <core:icon identifier="actions-add" />
+                {item.newContentAfterTitle}
+            </a>
+        </div>
     </f:if>
     <div class="t3-page-ce-dropzone-available t3js-page-ce-dropzone-available"></div>
 </div>
diff --git a/typo3/sysext/backend/Resources/Private/Partials/PageLayout/Record/Footer.html b/typo3/sysext/backend/Resources/Private/Partials/PageLayout/Record/Footer.html
index 3f7d3c38841f..c0b4c95e89c8 100644
--- a/typo3/sysext/backend/Resources/Private/Partials/PageLayout/Record/Footer.html
+++ b/typo3/sysext/backend/Resources/Private/Partials/PageLayout/Record/Footer.html
@@ -1,7 +1,7 @@
 <div class="t3-page-ce-footer">
     <div class="t3-page-ce-info">
         <f:for each="{item.footerInfo}" as="infoLine" iteration="iteration">
-            {infoLine}<f:if condition="!{iteration.isLast}"><br /></f:if>
+            {infoLine -> f:format.raw()}<f:if condition="!{iteration.isLast}"><br /></f:if>
         </f:for>
     </div>
 </div>
-- 
GitLab