[BUGFIX] Preserve multivalue property sorting in form fields 23/56723/2
authorRalf Zimmermann <ralf.zimmermann@tritum.de>
Thu, 22 Feb 2018 18:30:18 +0000 (19:30 +0100)
committerFrank Naegler <frank.naegler@typo3.org>
Thu, 19 Apr 2018 10:00:12 +0000 (12:00 +0200)
commit6b672293cd6605072b7b0429d80cbf3ac107c581
treed88d33c7b2413574bf6bbf518a5f373afb990a19
parent5fe2a684e1e8fa0787854b335e0cf3443bad8e2d
[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>
Reviewed-on: https://review.typo3.org/56723
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