From 6a297d120894a435adc4b4740ef98e542a03cecb Mon Sep 17 00:00:00 2001 From: stigfaerch Date: Tue, 12 Jan 2016 16:03:51 +0100 Subject: [PATCH] Fix for https://forge.typo3.org/issues/72403 --- Classes/Backend/LayoutSetup.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Classes/Backend/LayoutSetup.php b/Classes/Backend/LayoutSetup.php index a5ed933..9f27888 100644 --- a/Classes/Backend/LayoutSetup.php +++ b/Classes/Backend/LayoutSetup.php @@ -73,6 +73,13 @@ public function init($pageId, $typoScriptSetup = array()) { $this->setDatabaseConnection($GLOBALS['TYPO3_DB']); $this->setLanguageService($GLOBALS['LANG']); + + // new element inserted after existing one + if(\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($pageId) && $pageId < 0) { + $pidRec = BackendUtility::getRecord('tt_content', abs($pageId), 'pid'); + $pageId = is_array($pidRec) ? (int)$pidRec['pid'] : 0; + } + $pageId = (strpos($pageId, 'NEW') === 0) ? 0 : (int)$pageId; $this->loadLayoutSetup($pageId); foreach ($this->layoutSetup as $key => $setup) { @@ -87,6 +94,7 @@ public function init($pageId, $typoScriptSetup = array()) return $this; } + /** * setter for layout setup *