Review main Merged Breaking

73518[!!!][FEATURE] Avoid BackendTemplateView

Christian Kuhn CR +2 V +2 Expert +620 −552 updated 02/16/22, 20:10

Commit message

Class BackendTemplateView has been a temporary solution
to simplify the implementation of the "TsConfig template
override" feature into smaller patches.

With ModuleTemplate and general view works being mostly
done in the backend, BackendTemplateView should be
removed again.

The patch removes all usages switching nearly all views
to BackendViewFactory, which removes the explicit
dependency to Typo3Fluid ViewInterface since the
EXT:core ViewInterface is not directly bound to Fluid
anymore.

Using BackendViewFactory has the additional advantage
that templates which don't use ModuleTemplate because
they're hook usages or some other "sub-view", can now
be overridden with TsConfig, too.

Using BackendViewFactory also makes the dependency to
ServerRequestInterface explicit. The patch thus hands
$request around at some more places where $request was
only an indirect dependency before.

One special @todo area is FormEngine, which is unable
to have dependency injection (for BackendViewFactory)
due to its manual constructor arguments. The patch
falls back to Typo3Fluid TemplateView in those cases.
The FormEngine API should be adapted with another patch.

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
    • Benjamin Franzke +1
    • Stefan Bürk +1
  • Verified V +2 Done
    • Christian Kuhn +2
    • Benjamin Franzke +1
    • Stefan Bürk +1
    • core-ci +1 CI

Issues 3

Files 74

Show 54 more files

Review log 2029

Show 34 earlier messages
  1. Christian Kuhn uploaded patch set 1 02/15/22, 11:46

  2. core-ci voted on patch set 1 V +1 02/15/22, 12:03 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23615

  3. Oli Bartsch commented on patch set 1 02/15/22, 13:27

    IMO this is a FEATURE, since new functionality is introduced, which allows to receive the PSR-7 Request in the toolbar items. Actually, I assume using the BackendViewFactory is also recommended for toolbar items of third party extensions, right? Therefore, the new interface will be mandatory.

    LiveSearchToolbarItem.php:35

    Why do we change the visibility to private? Is there a rule or guideline when to use private and when to use protected?

    RequestAwareToolbarItemInterface.php:26

    Like mentioned in my other comment, since this is public API, it should somehow be documented, e.g. in Feature.rst. Third party extensions will benefit from using this interface.
  4. Oli Bartsch commented on patch set 1 02/15/22, 13:49

    ClearCacheToolbarItem.php:38

    Should we define this as nullable? This will otherwise lead to an exception, when accessing this (indirectly by calling a public method, using the $request), while setRequest() had not been called beforehand.
  1. Christian Kuhn uploaded patch set 2 02/16/22, 11:25

  2. Christian Kuhn commented on patch set 2 02/16/22, 11:26

    decided to put *all* BackendTemplateView removals into this patch for now ... may split later again and will then take care of comments, too.
  3. core-ci voted on patch set 2 V -1 02/16/22, 11:34 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23714

  4. Christian Kuhn uploaded patch set 3 02/16/22, 13:22

  5. Christian Kuhn uploaded patch set 4 02/16/22, 13:27

  6. core-ci voted on patch set 3 V -1 02/16/22, 13:37 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23720

  7. core-ci voted on patch set 4 V -1 02/16/22, 13:48 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23721

  8. Christian Kuhn uploaded patch set 5 02/16/22, 14:59

  9. Christian Kuhn commented on patch set 5 02/16/22, 15:03

    Reply

    Done

    ClearCacheToolbarItem.php:38 Reply

    No. The toolbar item should very well assume that setRequest() is called when RequestAwareToolbarItemInterface is implemented. Otherwise, that is a fail in the calling core code and should fail.

    LiveSearchToolbarItem.php:35 Reply

    no strict rule (yet). imho: these classes must not be xclassed / extended. they should actually be final. there is a registration to override with own classes if needed. so private for these 'leaf' classes really should be fine here. I was not totally sure here for the toolbar items, but I think it's fair enough to do it. If you insist on going back to protected, I'll do so, though.

    RequestAwareToolbarItemInterface.php:26 Reply

    will document.
  10. core-ci voted on patch set 5 V -1 02/16/22, 15:14 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23730

  11. Christian Kuhn uploaded patch set 6 02/16/22, 15:40

  12. core-ci voted on patch set 6 V +1 02/16/22, 15:48 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23732

  13. Christian Kuhn uploaded patch set 7 02/16/22, 16:50

  14. core-ci voted on patch set 7 V +1 02/16/22, 16:59 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23737

  15. Christian Kuhn uploaded patch set 8 02/16/22, 17:19

  16. core-ci voted on patch set 8 V +1 02/16/22, 17:30 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23738

  17. Christian Kuhn updated the commit message in patch set 9 02/16/22, 17:31

  18. core-ci voted on patch set 9 V +1 02/16/22, 17:43 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23739

  19. Stefan Bürk voted on patch set 9 V +1 CR +1 02/16/22, 19:06

  20. Benjamin Franzke commented on patch set 9 CR +1 02/16/22, 19:22

    thx!
  21. Benjamin Franzke commented on patch set 9 V +1 02/16/22, 19:51

    AbstractController.php:45

    RenderingContextFactory could/should be injected. But not a blocker right now.

    InstallerController.php:1145

    RenderingContextFactory could/should be injected. But not a blocker right now.
  22. Christian Kuhn commented on patch set 9 02/16/22, 19:56

    AbstractController.php:45 Reply

    Ack. impossible in this case at the moment, since abstract should use inject* methods, but fail-safe container does not support this currently. may need a dedicated patch.

    InstallerController.php:1145 Reply

    Ack. impossible in this case at the moment, since abstract should use inject* methods, but fail-safe container does not support this currently. may need a dedicated patch.
  23. Christian Kuhn voted on patch set 9 V +2 CR +2 02/16/22, 20:06

  24. Christian Kuhn merged patch set 10 02/16/22, 20:06

  25. Benjamin Franzke commented on patch set 10 02/16/22, 20:10

    AbstractController.php:45 Reply

    No, all installtool controllers are manually wired in install/ServiceProvider.php, therefore . Anyway, we can fix that later, and maybe rather introduce a View factory for the installtool instead (and drop AbstractController).