Review main Merged

92839[TASK] Separate compiling and asset handling concerns of FormEngine

Andreas Nedbal CR +2 V +2 Hard +347 −212 updated 02/24/26, 19:45

Commit message

This change splits the responsibilities of FormResultCompiler
into focused, single-purpose classes.

Previously, FormResultCompiler accumulated state from multiple
form renderings and offered methods to pass the collected assets
to PageRenderer by itself. This made it impractical for scenarios
where FormEngine markup and required assets need to be handled
separately, such as dynamic loading inside modals.

The new structure introduces:

- FormResult: Immutable value object carrying the rendering output
  of a single FormEngine element with all its asset dependencies.
- FormResultCollection: Aggregates multiple FormResult objects and
  provides a deduplicated, merged view of all required page assets.
- FormResultFactory: Replaces FormResultCompiler, transforming the
  raw array returned by node rendering into a typed FormResult.
- FormResultHandler: Bridges FormEngine rendering and PageRenderer
  by registering all declared asset dependencies.

Review

  • Code review CR +2 Done
    • Georg Ringer +2
    • Benni Mack +1
  • Verified V +2 Done
    • Georg Ringer +2
    • Benni Mack +1
    • core-ci +1 CI

Issues 1

Files 10

Review log 67101

Show 5176 earlier messages
  1. Andreas Nedbal uploaded patch set 1 02/13/26, 15:54

  2. core-ci voted on patch set 1 V -1 02/13/26, 16:02 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95840

  3. Stefan Bürk commented on patch set 1 02/13/26, 16:08

    FormResult.php:20

    class final and readonly instead of readonly properties ? Q: Is a completly immutable result really useful ? Could there be cases having it instanciated and passed around to later be filled more with data .. or is it expected to only created once ?
  4. Andreas Nedbal commented on patch set 1 02/13/26, 16:17

    FormResult.php:20 Reply

    Ack on `final readonly`! Looking at all previous usages and the future use case of the result, there were no cases that require later manipulation. Or, there was one, in EditDocumentController->makeEditForm where a hidden field with a PID was appended to the forms HTML. I adjusted the approach to adding this hidden field to `additionalHiddenFields` before compiling. Otherwise I would have made the HTML property mutable probably.
  5. Benjamin Kott commented on patch set 1 02/14/26, 07:42

    EditDocumentController.php:2096

    this feels wrong, this is not really something that should be merged? each form result should stay for it´s own and we should provde a FormResultCollection or something to access the merged values.
  6. Andreas Nedbal rebased onto patch set 2 V -1 02/16/26, 14:54

  7. core-ci voted on patch set 2 V -1 02/16/26, 15:07 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95969

  8. Andreas Nedbal rebased onto patch set 3 V -1 02/17/26, 12:32

    The following files contain Git conflicts: * typo3/sysext/backend/Classes/Form/FormResultCompiler.php
  9. Andreas Nedbal uploaded patch set 4 02/17/26, 12:59

  10. Andreas Nedbal rebased onto patch set 5 02/17/26, 12:59

    The following files contain Git conflicts: * typo3/sysext/backend/Classes/Form/FormResultCompiler.php
  11. Andreas Nedbal uploaded patch set 6 02/17/26, 13:01

  12. Andreas Nedbal marked it ready for review 02/17/26, 13:01

  13. Andreas Nedbal uploaded patch set 7 02/17/26, 13:06

  14. Andreas Nedbal uploaded patch set 8 02/17/26, 13:16

  15. core-ci voted on patch set 4 V -1 02/17/26, 13:16 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96044

  16. Andreas Nedbal uploaded patch set 9 02/17/26, 13:27

  17. core-ci voted on patch set 3 V -1 02/17/26, 13:36 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96040

  18. core-ci voted on patch set 7 V -1 02/17/26, 13:38 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96049

  19. core-ci voted on patch set 6 V -1 02/17/26, 13:38 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96046

  20. core-ci voted on patch set 8 V -1 02/17/26, 13:38 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96052

  21. core-ci voted on patch set 5 V -1 02/17/26, 13:38 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96045

  22. core-ci voted on patch set 9 V -1 02/17/26, 14:11 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96057

  23. Andreas Nedbal uploaded patch set 10 V -1 02/17/26, 14:26

  24. core-ci voted on patch set 10 V +1 02/17/26, 14:38 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96060

  25. Andreas Nedbal commented on patch set 10 02/17/26, 14:38

    EditDocumentController.php:2096 Reply

    Done

    FormResult.php:20 Reply

    Done
  26. Tobias Wojtylak commented on patch set 10 02/18/26, 07:48

    Looks good! It would be great to include some tests to cover this.

    FormResultCollection.php:62

    not sure if we should use phpdoc for the return value. E.g. ``` /** * @return string[] */ ``` but maybe the IDE is smart enough?

    FormResultCollection.php:64

    maybe we can avoid in_array in the loop (for every file): e.g. ``` $files = []; foreach ($this->results as $result) { foreach ($result->stylesheetFiles as $file) { $files[$file] = true; } } return array_keys($files); ```

    FormResultHandler.php:81

    Is it possible to inject the service instead of using GLOBALS?
  27. Oli Bartsch commented on patch set 10 02/18/26, 08:04

    Could you please specify use cases for the new FormResult which are not leading to the result being passed to the PageRenderer?

    EditDocumentController.php:198

    What about injecting a `FormResultHandlerInterface`? This came to my mind when thinking about the use cases I've mentioned in the comment in the commit message.

    EditDocumentController.php:312

    So when using an interface this might become just `addAssets()`. Depending on the implementation, this might use PageRenderer, or not.

    EditDocumentController.php:328

    Maybe `getHiddenFieldsMarkup()` or `getHiddenFieldsHtml()`?

    FormResult.php:23

    Why can this be nullable? I think if we construct a FormResult without any meaningful markup, this place needs special handling anyways. Can also not see a case in the current patch, which might lead to passing null here.

    FormResultCompiler.php:62

    I think those null checks can be omitted. See `initializeResultArray()`. If anything is null here, there is another issue in the code which should not be hidden.
  28. Andreas Nedbal uploaded patch set 11 V +1 02/18/26, 12:33

  29. Andreas Nedbal commented on patch set 11 02/18/26, 12:36

    EditDocumentController.php:198 Reply

    Done

    EditDocumentController.php:312 Reply

    If we make it an interface I'd rather go for "handle" (that's what a Handler does), so I went with that.

    EditDocumentController.php:328 Reply

    I personally think that just calling it getHiddenFields is fine, we don't really have another representation for them, so just assuming it's the markup by default should be alright?

    FormResult.php:23 Reply

    Done

    FormResultCollection.php:62 Reply

    Done

    FormResultCollection.php:64 Reply

    Done

    FormResultCompiler.php:62 Reply

    Done

    FormResultHandler.php:81 Reply

    > argument "$languageService" of method "__construct()" needs an instance of "TYPO3\CMS\Core\Localization\LanguageService" but this type has been excluded in "Configuration/Services.yaml". It can't.
  30. Andreas Nedbal updated the commit message in patch set 12 02/18/26, 12:38

  31. Andreas Nedbal commented on patch set 12 02/18/26, 12:38

    Reply

    Done
  32. core-ci voted on patch set 11 V -1 02/18/26, 13:12 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96132

  33. Andreas Nedbal rebased onto patch set 13 02/18/26, 13:13

  34. core-ci voted on patch set 12 V -1 02/18/26, 13:18 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96134

  35. core-ci voted on patch set 13 V -1 02/18/26, 13:28 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96137

  36. Andreas Nedbal uploaded patch set 14 V -1 02/18/26, 15:19

  37. core-ci voted on patch set 14 V -1 02/18/26, 15:38 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96160

  38. Tobias Wojtylak commented on patch set 14 02/18/26, 16:44

    FormResultCollection.php:77

    Do we need array_unique() here?

    FormResultCollection.php:131

    If multiple saveFieldNames are defined, should the class really return only the last one in the sequence? Or can this not occur at all?
  39. Andreas Nedbal uploaded patch set 15 V -1 02/19/26, 10:33

  40. core-ci voted on patch set 15 V -1 02/19/26, 10:47 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96230

  41. Andreas Nedbal uploaded patch set 16 V -1 02/19/26, 10:54

  42. Andreas Nedbal commented on patch set 15 02/19/26, 11:00

    FormResultCollection.php:77 Reply

    Done

    FormResultCollection.php:131 Reply

    There only is either one or none used at all, the loop in makeEditForm sets it for all form results though. So, taking the first one or the last one is just a choice of preference. (I think leaving the full loop is fine to because there will never be that many FormResults that this will impact performance in any meaningful way)
  43. core-ci voted on patch set 16 V +1 02/19/26, 11:03 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96234

  44. Andreas Nedbal commented on patch set 16 02/19/26, 14:18

    FormResultCollection.php:131 Reply

    Done
  45. Andreas Nedbal uploaded patch set 17 V +1 02/19/26, 14:58

  46. core-ci voted on patch set 17 V +1 02/19/26, 15:09 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96260

  47. Andreas Nedbal commented on patch set 17 02/19/26, 15:13

    EditDocumentController.php:328 Reply

    Done
  48. Andreas Nedbal uploaded patch set 18 V +1 02/19/26, 15:57

  49. core-ci voted on patch set 18 V +1 02/19/26, 16:08 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96264

  50. Benjamin Kott commented on patch set 18 02/19/26, 22:12

    FormResultHandler.php:79

    we still have the inline labels here and also the inline settings for the date config, i thought we are going to extract them in a prepatch?
  51. Benjamin Kott commented on patch set 18 02/20/26, 00:10

    FormResultCollection.php:138

    I would really like to see this gone for good. 92910: [TASK] Remove doSave hidden field from FormEngine | https://review.typo3.org/c/Packages/TYPO3.CMS/+/92910
  52. Benjamin Kott commented on patch set 18 02/20/26, 00:14

    FormResultHandler.php:55

    we should get rid of this inline setting as well, we are already invoking the form-engine below.

    FormResultHandlerInterface.php:20

    would like to prefer no interface here, as we are probably not planning to make this exchangeable.
  53. Oli Bartsch commented on patch set 18 02/20/26, 08:08

    FormResultHandlerInterface.php:20 Reply

    This was based on my comment. When reading the commit message `This is impractical for purposes where FormEngine markup and required assets need to be handled separately, or by something completely unrelated to PageRenderer.` it suggests, form engine assets can be added / rendered by any component not just via PageRenderer. If we would not make this exchangeable, I see no benefit in extracting this at all.
  54. Andreas Nedbal uploaded patch set 19 V +1 02/20/26, 13:46

  55. Andreas Nedbal commented on patch set 19 02/20/26, 13:50

    FormResultHandler.php:55 Reply

    Done, I guess? I just added `editform` into the TypeScript here and made the override using `TYPO3.settings.FormEngine.formName` still work.

    FormResultHandler.php:79 Reply

    The labels will still be handled in pre-patches. I moved the DateConfiguration into ModuleTemplate in this patch here (there was no other "generic" location that I could think of, I take suggestions here though)

    FormResultHandlerInterface.php:20 Reply

    Done
  56. core-ci voted on patch set 19 V -1 02/20/26, 13:57 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96355

  57. Andreas Nedbal uploaded patch set 20 V -1 02/20/26, 13:59

  58. core-ci voted on patch set 20 V +1 02/20/26, 14:14 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96358

  59. Benjamin Franzke commented on patch set 20 02/23/26, 07:40

    ModuleTemplate.php:170

    Do you know why you needed this? The JS code reads this config from `top.` (not nice, but helpful to not require it to be set here), see https://github.com/TYPO3/typo3/blob/d827863e059f01194370e3a0a88bc1f8e071930e/Build/Sources/TypeScript/backend/element/datetime-element.ts#L260
  60. Andreas Nedbal rebased onto patch set 21 V +1 02/23/26, 15:13

    The following files contain Git conflicts: * typo3/sysext/backend/Classes/Controller/EditDocumentController.php * typo3/sysext/backend/Classes/Form/FormResultCompiler.php * typo3/sysext/backend/Resources/Public/JavaScript/form-engine.js
  61. Andreas Nedbal uploaded patch set 22 02/23/26, 15:25

  62. Andreas Nedbal marked it ready for review 02/23/26, 15:25

  63. core-ci voted on patch set 22 V +1 02/23/26, 15:39 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96594

  64. Andreas Nedbal commented on patch set 22 02/23/26, 15:42

    FormResultCollection.php:138 Reply

    Done
  65. Andreas Nedbal uploaded patch set 23 V +1 02/23/26, 15:54

  66. Andreas Nedbal uploaded patch set 24 02/23/26, 15:54

  67. Andreas Nedbal commented on patch set 24 02/23/26, 15:56

    ModuleTemplate.php:170 Reply

    Remove this, as the same configuration is set in BackendController (which also explains the config check in `top.` which is already present in JS)
  68. core-ci voted on patch set 23 V +1 02/23/26, 16:07 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96599

  69. core-ci voted on patch set 24 V +1 02/23/26, 16:10 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96600

  70. core-ci voted on patch set 21 V -1 02/23/26, 16:24 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96592

  71. Benjamin Kott commented on patch set 24 02/23/26, 16:50

    form-engine.ts:165

    cannot it just be set to editform? do we set it anywhere?
  72. Andreas Nedbal rebased onto patch set 25 V +1 02/24/26, 09:05

    The following files contain Git conflicts: * typo3/sysext/backend/Resources/Public/JavaScript/form-engine.js
  73. Andreas Nedbal uploaded patch set 26 02/24/26, 09:31

  74. Andreas Nedbal marked it ready for review 02/24/26, 09:31

  75. core-ci voted on patch set 26 V +1 02/24/26, 09:49 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96691

  76. Andreas Nedbal uploaded patch set 27 V +1 02/24/26, 09:53

  1. core-ci voted on patch set 25 V -1 02/24/26, 10:04 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96687

  2. core-ci voted on patch set 27 V +1 02/24/26, 10:08 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96695

  3. Andreas Nedbal rebased onto patch set 28 V +1 02/24/26, 10:40

    The following files contain Git conflicts: * typo3/sysext/backend/Resources/Public/JavaScript/form-engine.js
  4. Andreas Nedbal uploaded patch set 29 02/24/26, 10:43

  5. Andreas Nedbal marked it ready for review 02/24/26, 10:44

  6. Andreas Nedbal uploaded patch set 30 02/24/26, 10:58

  7. Andreas Nedbal commented on patch set 30 02/24/26, 11:01

    form-engine.ts:165 Reply

    Done

    FormResultHandler.php:79 Reply

    The label file additions have now been removed as all lll/TYPO3.lang usages have been taken care of.
  8. core-ci voted on patch set 29 V -1 02/24/26, 11:06 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96703

  9. Simon Schaufelberger commented on patch set 30 02/24/26, 11:06

    FormResultHandler.php:29

    Since the FormResultCompiler is internal, make this internal as well?
  10. Andreas Nedbal uploaded patch set 31 02/24/26, 11:11

  11. Andreas Nedbal commented on patch set 31 02/24/26, 11:11

    FormResultHandler.php:29 Reply

    Done
  12. core-ci voted on patch set 28 V -1 02/24/26, 11:28 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96702

  13. core-ci voted on patch set 30 V -1 02/24/26, 11:58 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96708

  14. core-ci voted on patch set 31 V -1 02/24/26, 12:00 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96712

  15. Andreas Nedbal uploaded patch set 32 V -1 02/24/26, 12:25

  16. core-ci voted on patch set 32 V +1 02/24/26, 12:42 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96728

  17. Benjamin Franzke uploaded patch set 33 V +1 02/24/26, 13:15

  18. Benjamin Franzke commented on patch set 33 02/24/26, 13:15

    form-engine.ts:165

    I (think) the idea was to remove the setting from `TYPO3.settings`, we can keep the constant in here. Done.
  19. core-ci voted on patch set 33 V +1 02/24/26, 14:08 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96737

  20. Benni Mack commented on patch set 33 CR -1 02/24/26, 15:42

    this looks good, I will go over it and give some minor final things to it.
  21. Benni Mack uploaded patch set 34 CR -1 V +1 02/24/26, 16:53

  22. Benni Mack voted on patch set 34 CR +1 V +1 02/24/26, 16:53

  23. core-ci voted on patch set 34 V +1 02/24/26, 17:12 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96771

  24. Georg Ringer voted on patch set 34 CR +2 V +2 02/24/26, 19:45

  25. Georg Ringer merged patch set 35 02/24/26, 19:45