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 *