[BUGFIX] Data merging in FormEngine 61/40261/2
authorChristian Kuhn <lolli@schwarzbu.ch>
Mon, 15 Jun 2015 16:51:08 +0000 (18:51 +0200)
committerFrank Nägler <frank.naegler@typo3.org>
Mon, 15 Jun 2015 17:18:52 +0000 (19:18 +0200)
Data is merged in a wrong way and kills for instance
the required handling.

Resolves: #67470
Related: #67400
Releases: master
Change-Id: I0b78fb34b443be89663188b14db192b58804fc5b
Reviewed-on: http://review.typo3.org/40261
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/Form/FormEngine.php

index 6a0e84d..c9f1f4b 100644 (file)
@@ -390,17 +390,17 @@ class FormEngine {
         * @return void
         */
        protected function mergeResult(array $resultArray) {
-               foreach ($resultArray['requiredElements'] as $element) {
-                       $this->requiredElements[] = $element;
+               foreach ($resultArray['requiredElements'] as $name => $element) {
+                       $this->requiredElements[$name] = $element;
                }
-               foreach ($resultArray['requiredFields'] as $element) {
-                       $this->requiredFields[] = $element;
+               foreach ($resultArray['requiredFields'] as $value => $name) {
+                       $this->requiredFields[$value] = $name;
                }
-               foreach ($resultArray['requiredAdditional'] as $element) {
-                       $this->requiredAdditional[] = $element;
+               foreach ($resultArray['requiredAdditional'] as $name => $subArray) {
+                       $this->requiredAdditional[$name] = $subArray;
                }
-               foreach ($resultArray['requiredNested'] as $element) {
-                       $this->requiredNested[] = $element;
+               foreach ($resultArray['requiredNested'] as $value => $name) {
+                       $this->requiredNested[$value] = $name;
                }
                foreach ($resultArray['additionalJavaScriptPost'] as $element) {
                        $this->additionalJS_post[] = $element;
@@ -408,7 +408,7 @@ class FormEngine {
                foreach ($resultArray['additionalJavaScriptSubmit'] as $element) {
                        $this->additionalJS_submit[] = $element;
                }
-               $this->extJSCODE = $this->extJSCODE . $resultArray['extJSCODE'];
+               $this->extJSCODE = $this->extJSCODE . LF . $resultArray['extJSCODE'];
                $this->inlineData = $resultArray['inlineData'];
                foreach ($resultArray['additionalHiddenFields'] as $element) {
                        $this->hiddenFieldAccum[] = $element;
@@ -416,6 +416,13 @@ class FormEngine {
                foreach ($resultArray['additionalHeadTags'] as $element) {
                        $this->additionalCode_pre[] = $element;
                }
+
+               if (!empty($resultArray['inlineData'])) {
+                       $resultArrayInlineData = $this->inlineData;
+                       $resultInlineData = $resultArray['inlineData'];
+                       ArrayUtility::mergeRecursiveWithOverrule($resultArrayInlineData, $resultInlineData);
+                       $this->inlineData = $resultArrayInlineData;
+               }
        }
 
        /**