[BUGFIX] FormEngine: Inline records open after first save 78/48378/3
authorChristian Kuhn <lolli@schwarzbu.ch>
Sat, 28 May 2016 20:52:56 +0000 (22:52 +0200)
committerMarkus Klein <markus.klein@typo3.org>
Sun, 29 May 2016 09:25:42 +0000 (11:25 +0200)
After creating and saving new inline elements, those elements
should be open by default. This was the case earlier, but broke
somewhere during FormEngine refactoring.

The patch restores this functionality. However, this patch is
restricted for master only since various scenarios are possible
that lead to funny open/close state. Those need further work.

Change-Id: I3b7dd6ebb5141f00317ef508b94ac41f4d44d265
Resolves: #76360
Releases: master
Reviewed-on: https://review.typo3.org/48378
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/backend/Classes/Controller/FormInlineAjaxController.php

index 3c2b4c0..f2a1edc 100644 (file)
@@ -56,6 +56,7 @@ class FormInlineAjaxController
         $inlineStackProcessor = GeneralUtility::makeInstance(InlineStackProcessor::class);
         $inlineStackProcessor->initializeByParsingDomObjectIdString($domObjectId);
         $inlineStackProcessor->injectAjaxConfiguration($ajaxArguments['context']);
+        $inlineTopMostParent = $inlineStackProcessor->getStructureLevel(0);
 
         // Parent, this table embeds the child table
         $parent = $inlineStackProcessor->getStructureLevel(-1);
@@ -125,6 +126,10 @@ class FormInlineAjaxController
             'inlineParentTableName' => $parent['table'],
             'inlineParentFieldName' => $parent['field'],
             'inlineParentConfig' => $parentConfig,
+            // Fallback to $parentData is probably not needed here.
+            'inlineTopMostParentUid' => $parentData['inlineTopMostParentUid'] ?: $inlineTopMostParent['uid'],
+            'inlineTopMostParentTableName' => $parentData['inlineTopMostParentTableName'] ?: $inlineTopMostParent['table'],
+            'inlineTopMostParentFieldName' => $parentData['inlineTopMostParentFieldName'] ?: $inlineTopMostParent['field'],
         ];
         if ($childChildUid) {
             $formDataCompilerInput['inlineChildChildUid'] = $childChildUid;