[BUGFIX] Fix save and view page for a new page record 44/46744/2
authorWouter Wolters <typo3@wouterwolters.nl>
Tue, 16 Feb 2016 22:24:58 +0000 (23:24 +0100)
committerWouter Wolters <typo3@wouterwolters.nl>
Wed, 17 Feb 2016 10:54:49 +0000 (11:54 +0100)
The current page id is not set correctly because the popViewId
contains not the uid of the created page. Because it is meant
to fetch the uid of the current page anyway we can
use the record id.

Resolves: #73428
Resolves: #73475
Releases: master,7.6
Change-Id: I4c34547d9a9cf8acd1de01473e931d0fb6a634d8
Reviewed-on: https://review.typo3.org/46744
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/backend/Classes/Controller/EditDocumentController.php

index 7a11f2b..f84c7c0 100644 (file)
@@ -818,10 +818,15 @@ class EditDocumentController extends AbstractModule
      */
     protected function generatePreviewCode()
     {
-        $currentPageId = MathUtility::convertToPositiveInteger($this->popViewId);
         $table = $this->previewData['table'];
         $recordId = $this->previewData['id'];
 
+        if ($table === 'pages') {
+            $currentPageId = $recordId;
+        } else {
+            $currentPageId = MathUtility::convertToPositiveInteger($this->popViewId);
+        }
+
         $pageTsConfig = BackendUtility::getPagesTSconfig($currentPageId);
         $previewConfiguration = isset($pageTsConfig['TCEMAIN.']['preview.'][$table . '.'])
             ? $pageTsConfig['TCEMAIN.']['preview.'][$table . '.']