[BUGFIX] EXT:form - editor error on mixed option key types 21/51421/2
authorRalf Zimmermann <ralf.zimmermann@tritum.de>
Wed, 25 Jan 2017 10:00:40 +0000 (11:00 +0100)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Wed, 25 Jan 2017 10:10:42 +0000 (11:10 +0100)
Let the JavaScript 'Inspector-PropertyGridEditor' deal with mixed
option value types (string / int)

Resolves: #79457
Releases: master
Change-Id: I7e9a377d9a5d6e9f1336c25bc114c974a70b7284
Reviewed-on: https://review.typo3.org/51421
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
typo3/sysext/form/Resources/Public/JavaScript/Backend/FormEditor/InspectorComponent.js
typo3/sysext/form/Resources/Public/JavaScript/Backend/FormEditor/StageComponent.js

index ae0855e..642159c 100644 (file)
@@ -1372,9 +1372,16 @@ define(['jquery',
                     }
                     setData(propertyData[propertyDataKey], propertyDataKey);
                 }
-            } else {
-                for (var i = 0, len = propertyData.length; i < len; ++i) {
-                    setData(propertyData[i]['_label'], propertyData[i]['_value']);
+            } else if ('array' === $.type(propertyData)) {
+                for (var propertyDataKey in propertyData) {
+                    if (!propertyData.hasOwnProperty(propertyDataKey)) {
+                        continue;
+                    }
+                    if (getUtility().isUndefinedOrNull(propertyData[propertyDataKey]['_label'])) {
+                        setData(propertyData[propertyDataKey], propertyDataKey);
+                    } else {
+                        setData(propertyData[propertyDataKey]['_label'], propertyData[propertyDataKey]['_value']);
+                    }
                 }
             }
         };
index f69b522..e843a75 100644 (file)
@@ -1012,8 +1012,15 @@ define(['jquery',
                     appendMultiValue(propertyValue[propertyValueKey], propertyValueKey, defaultValue);
                 }
             } else if ('array' === $.type(propertyValue)) {
-                for (var i = 0, len = propertyValue.length; i < len; ++i) {
-                    appendMultiValue(propertyValue[i]['_label'], propertyValue[i]['_value'], defaultValue);
+                for (var propertyValueKey in propertyValue) {
+                    if (!propertyValue.hasOwnProperty(propertyValueKey)) {
+                        continue;
+                    }
+                    if (getUtility().isUndefinedOrNull(propertyValue[propertyValueKey]['_label'])) {
+                        appendMultiValue(propertyValue[propertyValueKey], propertyValueKey, defaultValue);
+                    } else {
+                        appendMultiValue(propertyValue[propertyValueKey]['_label'], propertyValue[propertyValueKey]['_value'], defaultValue);
+                    }
                 }
             }
         };