[BUGFIX] Flex form section container with group elements 05/52105/3
authorChristian Kuhn <lolli@schwarzbu.ch>
Mon, 20 Mar 2017 17:28:17 +0000 (18:28 +0100)
committerFrank Nägler <frank.naegler@typo3.org>
Wed, 22 Mar 2017 13:50:22 +0000 (14:50 +0100)
The "create new flex form section container" ajax request fails to set
initialized data values of the data compiler to the render engine.
As a result, data values that expect to be at least an empty array
are null and for instance the GroupElement stumbles. Properly assign
calculated container data to the render engine to fix this.

Change-Id: I1205c2814608bbb23d4842333f0b047bc356b02a
Resolves: #80222
Releases: master
Reviewed-on: https://review.typo3.org/52105
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Jan Helke <typo3@helke.de>
Tested-by: Jan Helke <typo3@helke.de>
Reviewed-by: Frank Nägler <frank.naegler@typo3.org>
Tested-by: Frank Nägler <frank.naegler@typo3.org>
typo3/sysext/backend/Classes/Controller/FormFlexAjaxController.php

index 7606c92..ef88cc0 100644 (file)
@@ -93,6 +93,27 @@ class FormFlexAjaxController extends AbstractFormEngineAjaxController
         $formData['flexFormContainerElementCollapsed'] = false;
 
         $formData['flexFormFormPrefix'] = '[data][' . $flexFormSheetName . '][lDEF]' . '[' . $flexFormFieldName . ']' . '[el]';
+
+        // Set initialized data of that section container from compiler to the array part used
+        // by flexFormElementContainer which prepares parameterArray. Important for initialized
+        // values of group element.
+        if (isset($formData['databaseRow'][$fieldName]
+                ['data'][$flexFormSheetName]
+                ['lDEF'][$flexFormFieldName]
+                ['el'][$flexFormContainerIdentifier][$flexFormContainerName]['el']
+            )
+            && is_array($formData['databaseRow'][$fieldName]
+                ['data'][$flexFormSheetName]
+                ['lDEF'][$flexFormFieldName]
+                ['el'][$flexFormContainerIdentifier][$flexFormContainerName]['el']
+            )
+        ) {
+            $formData['flexFormRowData'] = $formData['databaseRow'][$fieldName]
+                ['data'][$flexFormSheetName]
+                ['lDEF'][$flexFormFieldName]
+                ['el'][$flexFormContainerIdentifier][$flexFormContainerName]['el'];
+        }
+
         $formData['parameterArray']['itemFormElName'] = 'data[' . $tableName . '][' . $formData['databaseRow']['uid'] . '][' . $fieldName . ']';
 
         // JavaScript code for event handlers: