Review main Merged

95279[TASK] Use dependency injection for the code editor configuration

Benni Mack CR +2 V +2 Expert +556 −695 updated 08/13/26, 06:52

Commit message

The code editor carried a "@todo: refactor to use DI" on its
`CodeEditor` class, which instantiated its dependencies through
`GeneralUtility::makeInstance()` and required every consumer to
call `registerConfiguration()` before a registry could be used.
Forgetting that call left the registries empty.

Modes and addons are exclusively defined in
`Configuration/Backend/T3editor/Modes.php` and `Addons.php` of the
active packages, so nothing ever registered them at runtime. The
mutable registries are therefore replaced by a single, injectable
`CodeEditorConfiguration` service that resolves the definitions of
all packages on first access and provides them as objects:

* `CodeEditor`, `ModeRegistry` and `AddonRegistry` are removed
* `CodeEditorConfiguration` receives the package manager, the
  assets cache and the cache identifier via constructor injection
* `Mode` and `Addon` become immutable data transfer objects
* `CodeEditorElement`, `JsonElement`, the styleguide ViewHelpers
  and `InitializeCodeEditorInEditFileForm` inject the new service

`getDefaultMode()` now throws an `InvalidModeException` if no mode
has been marked as default, instead of running into an
uninitialized typed property.

All classes involved are marked `@internal`.

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Georg Ringer +1
    • Stefan Bürk +1
  • Verified V +2 Done
    • Benni Mack +2
    • Georg Ringer +1
    • Oliver Klee +1
    • Stefan Bürk +1
    • core-ci +1 CI

Issues 1

Files 16

Review log 89

  1. Benni Mack uploaded patch set 1 08/12/26, 10:12

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

  3. Benni Mack marked it ready for review 08/12/26, 10:36

  4. Stefan Bürk voted on patch set 1 CR +1 08/12/26, 16:15

  5. Stefan Bürk voted on patch set 1 V +1 08/12/26, 19:22

  6. Oliver Klee voted on patch set 1 V +1 08/12/26, 20:00

  7. Georg Ringer voted on patch set 1 CR +1 V +1 08/13/26, 06:39

  8. Benni Mack commented on patch set 1 CR +2 V +2 08/13/26, 06:52

    thank you
  9. Benni Mack merged patch set 2 08/13/26, 06:52