[BUGFIX] Preserve order of finisher options in Form CE
[Packages/TYPO3.CMS.git] / typo3 / sysext / form / Classes / Hooks / DataStructureIdentifierHook.php
index fa775c5..9feb6c7 100644 (file)
@@ -107,11 +107,18 @@ class DataStructureIdentifierHook
                 $formPersistenceManager = GeneralUtility::makeInstance(ObjectManager::class)->get(FormPersistenceManagerInterface::class);
                 $formIsAccessible = false;
                 foreach ($formPersistenceManager->listForms() as $form) {
+                    $invalidFormDefinition = $form['invalid'] ?? false;
+                    $hasDeprecatedFileExtension = $form['deprecatedFileExtension'] ?? false;
+
+                    if ($form['location'] === 'storage' && $hasDeprecatedFileExtension) {
+                        continue;
+                    }
+
                     if ($form['persistenceIdentifier'] === $identifier['ext-form-persistenceIdentifier']) {
                         $formIsAccessible = true;
                     }
 
-                    if (isset($form['invalid']) && $form['invalid']) {
+                    if ($invalidFormDefinition || $hasDeprecatedFileExtension) {
                         $dataStructure['sheets']['sDEF']['ROOT']['el']['settings.persistenceIdentifier']['TCEforms']['config']['items'][] = [
                             $form['name'] . ' (' . $form['persistenceIdentifier'] . ')',
                             $form['persistenceIdentifier'],
@@ -249,8 +256,6 @@ class DataStructureIdentifierHook
                 $sheetElements['settings.finishers.' . $finisherIdentifier . '.' . $optionKey] = $elementConfiguration;
             }
 
-            ksort($sheetElements);
-
             $sheet[$sheetIdentifier]['ROOT']['el'] = $sheetElements;
             ArrayUtility::mergeRecursiveWithOverrule($sheets['sheets'], $sheet);
         }