Review main Merged

73598[TASK] Use composer name from request route

Christian Kuhn CR +2 V +2 Hard +490 −143 updated 02/20/22, 00:45

Commit message

Since backend routes contain the package name
which defined a route, we can use this in backend
view related API and don't need to hand over the
composer name as argument anymore in most situations.

The patch thus simplifies the ModuleTemplateFactory
API and its usages, refactors BackendViewFactory,
and adds some functional tests to verify
BackendViewFactory template path override logic.

Review

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

Issues 3

Files 114

Show 94 more files

Review log 2434

Show 59 earlier messages
  1. Christian Kuhn uploaded patch set 1 02/18/22, 07:24

  2. core-ci voted on patch set 1 V -1 02/18/22, 07:38 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23853

  3. Christian Kuhn uploaded patch set 2 02/18/22, 08:30

  4. core-ci voted on patch set 2 V -1 02/18/22, 08:49 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23862

  5. Christian Kuhn uploaded patch set 3 02/18/22, 10:09

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

  7. Christian Kuhn uploaded patch set 4 02/18/22, 11:56

  8. core-ci voted on patch set 4 V +1 02/18/22, 12:08 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23873

  9. Oli Bartsch commented on patch set 4 02/18/22, 14:04

    BackendViewFactory.php:45

    What would be the use case for a controller, calling this method, to provide multiple package names?

    Feature-96730-SimplifiedExtbackendModuleTemplateAPI.rst:46

    I think we should still mention the second parameter and describe what it is used for (maybe just copy parts of the comment from the factory). This parameter is really important for extension authors, since they need it on extending core while rendering templates from their package.

    ActionHandler.php:773

    Wow, this is an "interesting" hack.
  1. Christian Kuhn uploaded patch set 5 02/18/22, 14:48

  2. core-ci voted on patch set 5 V -1 02/18/22, 14:57 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23877

  3. Christian Kuhn commented on patch set 5 02/18/22, 15:06

    BackendViewFactory.php:45 Reply

    Good point. I was unsure here when I first created this API. Working with it, I came to the conclusion that allowing multiple entries here is more flexible: * Maybe sometimes extensions want to 'look-ahead' for other third party extensions and may include possible overrides of those by default. * The basic "get composer name from route, plus a single name an extension wants" is relatively hard restricted. There is no reason to not allow "more" here. * It may be eventually needed when an extension overrides an extension. The above points are not "strong" and we could probably ditch it. OTOH, it shouldn't harm to just make it an array here and handle it. I also just created functional tests that verify this should work. Is that ok with you? I'd like to avoid an API change here in the future in case we figure it's useful for another reason, so I went with an array now. -> imho resolved comment, please insist if you don't agree.

    Feature-96730-SimplifiedExtbackendModuleTemplateAPI.rst:46 Reply

    moduleTemplateFactory does not have that option with the patch anymore: I removed it. The only valid usage of "additional" paths is when using BackendViewFactory, and I now documented this in the according .rst in a better way. For module templates: iirc, there is no reason to allow overriding this in extensions - extensions would have to claim an own route for modules anyway, or register as TsConfig override if they want to just override templates. So the default template paths can *always* be fetched from the route. That's my reason to not allow it for ModuleTemplateFactory, *but* to allow it for BackendViewFactory. I *think* that is fine and I can't think of scenarios where this isn't sufficient. *If* we find additional scenarios where this second argument is a valid use case on ModuleTemplate, too, we could easily add it later, and then document it as well. -> imho resolved comment.
  4. Christian Kuhn uploaded patch set 6 02/18/22, 15:08

  5. Christian Kuhn commented on patch set 6 02/18/22, 15:14

    ActionHandler.php:773 Reply

    yes. this needs a refactoring of course. it's ugly.
  6. core-ci voted on patch set 6 V -1 02/18/22, 15:19 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23878

  7. Christian Kuhn commented on patch set 6 CR -1 02/18/22, 15:22

    BackendViewFactory.php:66

    *this* is actually a detail of ModuleTemplateFactory and should be done there.
  8. Christian Kuhn commented on patch set 6 02/18/22, 15:28

    BackendViewFactory.php:66 Reply

    forget this comment. it's totally legit this default path is added since it simplifies accessing default templates for instance for toolbars as well. after all, BackendViewFactory is part of ext:backend.
  9. Oli Bartsch commented on patch set 6 CR +1 02/18/22, 15:28

    BackendViewFactory.php:45 Reply

    ACK

    Feature-96730-SimplifiedExtbackendModuleTemplateAPI.rst:46 Reply

    Sorry, my fault. Thought this example is about the BackendViewFactory.
  10. Christian Kuhn uploaded patch set 7 02/18/22, 15:29

  11. core-ci voted on patch set 7 V +1 02/18/22, 15:38 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23880

  12. Benni Mack voted on patch set 7 CR +1 02/18/22, 15:46

  13. Christian Kuhn uploaded patch set 8 02/18/22, 15:57

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

  15. Stefan Bürk voted on patch set 8 CR +1 02/18/22, 16:13

  16. Christian Kuhn uploaded patch set 9 02/18/22, 18:46

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

  18. Benni Mack voted on patch set 9 CR +1 02/19/22, 21:14

  19. Benjamin Franzke voted on patch set 9 V +1 CR +1 02/19/22, 22:06

  20. Stefan Bürk commented on patch set 9 CR -1 02/19/22, 23:03

    on it

    BackendViewFactoryTest.php:106

    I think we should add a test showcasing / testing that fallback/chain picking of files (layout/template/partial) for registered package before is used. For ex. - package b: provides "Layout/FooLayout" and all other files - package a: proviedes all overriden template files, except "Layout/FooLayout" then the result should be: ``` Foo template from extension test_templates_a Foo layout from extension test_templates_b Foo partial from extension test_templates_a ``` This PageTS override solved the usage of the extbase/frontend override chain, but kept this logic. So having a small fallback test should be here, so we ensure this will not break in the future. Same for the PageTS override configuration.
  21. Stefan Bürk uploaded patch set 10 02/19/22, 23:21

  22. core-ci voted on patch set 10 V +1 02/19/22, 23:32 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23914

  23. Stefan Bürk commented on patch set 10 V +1 CR +1 02/19/22, 23:33

    BackendViewFactoryTest.php:106 Reply

    Done
  24. Benjamin Franzke voted on patch set 10 V +2 CR +2 02/20/22, 00:45

  25. Benjamin Franzke merged patch set 11 02/20/22, 00:45