[BUGFIX] Preserve multivalue property sorting in form fields 65/55865/4
authorRalf Zimmermann <ralf.zimmermann@tritum.de>
Thu, 22 Feb 2018 18:30:18 +0000 (19:30 +0100)
committerFrank Naegler <frank.naegler@typo3.org>
Wed, 18 Apr 2018 12:25:20 +0000 (14:25 +0200)
commit931f50c0b1f883f41f9cb017442fea76d32e16dc
tree436b08b376190f33cf679a57a51c500edd9f6846
parent819a118f763f4281a4c52a9bfd80b85fb4219768
[BUGFIX] Preserve multivalue property sorting in form fields

This ensures e.g. the order of select options is preserved between
form edits.

Background: If you put "{"5":"5","4":"4"}" into JavaScript the order is
arbitrary. Internally this issue is already covered by the form editor
by transforming such values into some meta structure like
"[{'_label': '5', '_value': '5'}, ]{'_label': '4', '_value': '4'}".

This fails if some multivalue properties are already set, and such a
formDefinition is opened by the form editor: "{"5":"5","4":"4"}" becomes
"{"4":"4","5":"5"}".

This fix converts such multivalue properties right before this data is
interpreted by JavaScript.

Resolves: #83911
Releases: master, 8.7
Change-Id: Ife5f6be959958fcf9a2cf5c3942b2549f33287a1
Reviewed-on: https://review.typo3.org/55865
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Tobi Kretschmann <tobi@tobishome.de>
Reviewed-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Tested-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Reviewed-by: Kay Strobach <typo3@kay-strobach.de>
Tested-by: Kay Strobach <typo3@kay-strobach.de>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
typo3/sysext/form/Classes/Controller/FormEditorController.php
typo3/sysext/form/Classes/Mvc/Property/TypeConverter/FormDefinitionArrayConverter.php [new file with mode: 0644]
typo3/sysext/form/Classes/Property/TypeConverter/FormDefinitionArrayConverter.php [deleted file]
typo3/sysext/form/Tests/Unit/Controller/FormEditorControllerTest.php
typo3/sysext/form/Tests/Unit/Mvc/Property/TypeConverter/FormDefinitionArrayConverterTest.php [new file with mode: 0644]
typo3/sysext/form/Tests/Unit/Property/TypeConverter/FormDefinitionArrayConverterTest.php [deleted file]
typo3/sysext/form/ext_localconf.php