Review main Merged

80329[TASK] Use ext:core ViewInterface in extbase

Hannes Lau CR +2 V +2 Hard +395 −80 updated 07/24/24, 06:43

Commit message

TYPO3 v12 added a new ViewInterface to ext:core that allows
implementing *any* view as long as it sticks to this interface.

This interface has been put into use for all backend modules,
combined with a factory that allows to set custom stuff per module.

Extbase however has not been touched: Extbase is still
tailored towards ext:fluid and Fluid standalone.

The patch changes this by adapting the Extbase related views towards
ext:core ViewInterface. This allows implementing "own" views not
depending on Fluid standalone.

The patch has to hop through quite some loops to allow this:

ext:core FluidViewAdapter is a class implemented in v12 that
is a facade between core views and Fluid. Unfortunatly,
extbase uses some "specialities" like "renderPartial()" from
Fluid, which ext:core ViewInterface does not implement. We
can not get rid of those within extbase any time soon. As such,
FluidViewAdapter now implements all the nasty details that
Fluid provides: FluidViewAdapter is now the main class between
extbase and Fluid views - it implements both the Fluid view
interface, plus ext:core ViewInterface. FluidViewAdapter in
itself is rather simple: It only holds the Fluid view instance.
Historically, many further operations were possible on
Fluid view classes, those were only wrappers around
RenderingContext, though. To keep backwards compatibility,
FluidViewAdapter now re-implements all these methods, but
deprecates them.

In addition to ext:core ViewInterface, FluidViewAdapter will continue
to implement getRenderingContext(), setRenderingContext() (probably),
renderSection() and renderPartial(). All other methods that are
wrappers around details of RenderingContext are marked @deprecatded.
Systems that need to work with details of Fluid, now need to test
for an instance of FluidViewAdapter to manipulate setRenderingContext
if needed.

This strategy will allow us to phase out ext:fluid StandaloneView and
ext:fluid TemplateView with further patches, which will further
simplify the layer towards Fluid standalone.

Within Extabse, the main view interface is now ext:core ViewInterface,
which free's the dependency to Fluid. JsonView is now the primary
example for a view that has no relation to Fluid anymore.

TYPO3 v14 can continue with hardening various type hints related
to views, those have been marked accordingly.

Note the handling related to ServerRequestInterface will see
some additional patches in this area as well.

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Georg Ringer +1
    • Hannes Lau +1
    • Simon Praetorius +1
    • Christian Kuhn +1
  • Verified V +2 Done
    • Benni Mack +2
    • Georg Ringer +1
    • Simon Praetorius +1
    • Christian Kuhn +1
    • core-ci +1 CI

Issues 3

Files 14

Review log 5285

Show 3360 earlier messages
  1. Hannes Lau uploaded patch set 1 08/03/23, 21:02

  2. Hannes Lau updated the commit message in patch set 2 08/03/23, 21:04

  3. core-ci voted on patch set 1 V -1 08/03/23, 21:18 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44980

  4. core-ci voted on patch set 2 V -1 08/03/23, 21:28 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44985

  5. Hannes Lau uploaded patch set 3 V -1 08/03/23, 21:44

  6. core-ci voted on patch set 3 V -1 08/03/23, 22:48 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/45000

  7. Patrick Schriner commented on patch set 3 CR -1 08/04/23, 07:27

    As JsonView is not an internal class and due to signature changes this would very much a breaking change. What's the benefit aside from removing two empty methods?
  8. Hannes Lau commented on patch set 3 08/05/23, 12:11

    Reply

    The main benefit of this change is decoupling the extbase controller from a specific type of view. You can create Json, XML, … views that do not need to implement the extra fluid specific methods. But I agree that this would be breaking. Maybe we can issue a deprecation with v13 and apply this change with v14. For now we could just allow the ViewResolverInterface::resolve to return either fluid or a core view. ActionController: ```php use TYPO3\CMS\Core\View\ViewInterface as CoreViewInterface; use TYPO3Fluid\Fluid\View\ViewInterface as FluidViewInterface; CoreViewInterface|FluidViewInterface ActionController::$view $view; ``` ViewResolverInterface ```php public function resolve(string $controllerObjectName, string $actionName, string $format): CoreViewInterface|FluidViewInterface; ``` GenericViewResolver ```php public function resolve(string $controllerObjectName, string $actionName, string $format): CoreViewInterface|FluidViewInterface ``` Or would you consider this breaking as well, because it extends the type of a protected property in a public class?
  9. Patrick Schriner commented on patch set 3 08/07/23, 06:47

    Reply

    I don't know what more strict people will say, but this would be fine for me
  10. Benni Mack commented on patch set 3 08/07/23, 11:47

    Reply

    I think we could keep the stub methods in v12 (or even now with the current patch) in JsonView, to not be breaking
  11. Christian Kuhn uploaded patch set 4 CR -1 V -1 07/21/24, 10:15

  12. core-ci voted on patch set 4 V -1 07/21/24, 10:24 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/61885

  13. Christian Kuhn uploaded patch set 5 V -1 07/21/24, 10:28

  14. core-ci voted on patch set 5 V -1 07/21/24, 10:38 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/61886

  15. Christian Kuhn uploaded patch set 6 V -1 07/21/24, 15:33

  16. core-ci voted on patch set 6 V -1 07/21/24, 15:41 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/61893

  17. Christian Kuhn uploaded patch set 7 V -1 07/21/24, 15:43

  18. core-ci voted on patch set 7 V -1 07/21/24, 15:51 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/61894

  19. Christian Kuhn uploaded patch set 8 V -1 07/21/24, 16:25

  20. core-ci voted on patch set 8 V -1 07/21/24, 16:33 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/61896

  21. Christian Kuhn uploaded patch set 9 V -1 07/21/24, 16:50

  22. core-ci voted on patch set 9 V -1 07/21/24, 16:56 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/61897

  23. Christian Kuhn uploaded patch set 10 V -1 07/21/24, 16:59

  24. core-ci voted on patch set 10 V -1 07/21/24, 17:05 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/61898

  25. Christian Kuhn uploaded patch set 11 V -1 07/21/24, 17:14

  26. core-ci voted on patch set 11 V -1 07/21/24, 17:19 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/61900

  27. Christian Kuhn uploaded patch set 12 V -1 07/21/24, 17:28

  28. Christian Kuhn uploaded patch set 13 07/21/24, 17:31

  29. core-ci voted on patch set 12 V -1 07/21/24, 17:37 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/61902

  30. core-ci voted on patch set 13 V -1 07/21/24, 17:38 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/61903

  31. core-ci voted on patch set 13 V +1 07/21/24, 17:44 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/61903

  32. Christian Kuhn commented on patch set 13 CR -1 07/21/24, 17:46

    ok. green for now, but details are not sorted out, yet.
  33. Georg Ringer commented on patch set 13 07/22/24, 09:33

    if it is a feature, please add an rst and usually we don't backport features to 12.4. maybe benni can have a final word there
  34. Christian Kuhn commented on patch set 13 07/23/24, 11:30

    Reply

    i'll take care. currently working on the patch. it will be main only, will be a task, and will have some deprecations as well.
  35. Christian Kuhn uploaded patch set 14 CR -1 V +1 07/23/24, 12:51

  36. core-ci voted on patch set 14 V +1 07/23/24, 12:59 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/62010

  37. Christian Kuhn uploaded patch set 15 V +1 07/23/24, 13:52

  38. core-ci voted on patch set 15 V -1 07/23/24, 13:57 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/62012

  39. Christian Kuhn uploaded patch set 16 V -1 07/23/24, 14:00

  40. core-ci voted on patch set 16 V -1 07/23/24, 14:06 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/62014

  41. Christian Kuhn uploaded patch set 17 V -1 07/23/24, 14:12

  42. Christian Kuhn uploaded patch set 18 07/23/24, 14:16

  43. core-ci voted on patch set 18 V +1 07/23/24, 14:23 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/62018

  44. core-ci voted on patch set 17 V +1 07/23/24, 14:24 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/62017

  45. Christian Kuhn uploaded patch set 19 V +1 07/23/24, 15:07

  46. core-ci voted on patch set 19 V -1 07/23/24, 15:15 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/62020

  47. Christian Kuhn uploaded patch set 20 V -1 07/23/24, 15:31

  48. core-ci voted on patch set 20 V -1 07/23/24, 15:39 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/62021

  49. Christian Kuhn uploaded patch set 21 V -1 07/23/24, 15:43

  50. Christian Kuhn uploaded patch set 22 07/23/24, 15:44

  51. core-ci voted on patch set 21 V -1 07/23/24, 15:52 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/62022

  52. core-ci voted on patch set 22 V -1 07/23/24, 15:53 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/62023

  53. Christian Kuhn uploaded patch set 23 V -1 07/23/24, 16:13

  54. core-ci voted on patch set 23 V +1 07/23/24, 16:19 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/62024

  55. Christian Kuhn uploaded patch set 24 V +1 07/23/24, 16:23

  56. core-ci voted on patch set 24 V +1 07/23/24, 16:30 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/62025

  57. Christian Kuhn uploaded patch set 25 V +1 07/23/24, 16:31

  58. Christian Kuhn uploaded patch set 26 07/23/24, 16:33

  59. core-ci voted on patch set 25 V +1 07/23/24, 16:37 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/62026

  60. core-ci voted on patch set 26 V +1 07/23/24, 16:40 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/62027

  1. Christian Kuhn uploaded patch set 27 V +1 07/23/24, 16:42

  2. Christian Kuhn uploaded patch set 28 07/23/24, 16:43

  3. core-ci voted on patch set 27 V +1 07/23/24, 16:48 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/62028

  4. core-ci voted on patch set 28 V +1 07/23/24, 16:50 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/62029

  5. Christian Kuhn uploaded patch set 29 V +1 07/23/24, 18:20

  6. core-ci voted on patch set 29 V +1 07/23/24, 18:27 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/62038

  7. Christian Kuhn uploaded patch set 30 V +1 07/23/24, 18:34

  8. core-ci voted on patch set 30 V +1 07/23/24, 18:40 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/62039

  9. Christian Kuhn commented on patch set 30 07/23/24, 18:40

    Reply

    Done
  10. Hannes Lau commented on patch set 30 07/23/24, 19:12

    I am very happy to see that you are working on this! The change seems way more complicated than I first thought. But I see that you are trying to wrap the fluid views into an adapter instead of of allowing the ViewResolver to return both (fluid or non fluid).

    ActionController.php:490

    As far as I understand, this line is the only way for a view to get the extbase request. Due to the `instanceof FluidViewAdapter`, the request is only available to Fluid views. The extbase request can be important, to instantiate a `\TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder` and build URLs for actions of the current controller. Would it be feasible to pass the extbase request to all views that would accept it? Something like a `ExtbaseRequestAwareInterface`? Or would this be better suited for another issue/change?
  11. Simon Praetorius commented on patch set 30 07/23/24, 19:22

    FluidViewAdapter.php:23

    Maybe also use `as CoreRenderingContext` here to make things clearer

    FluidViewAdapter.php:217

    This error message is confusing, I would at least add `getRenderingContext()->getTemplatePaths()->setFormat()`
  12. Christian Kuhn uploaded patch set 31 V +1 07/23/24, 19:29

  13. Christian Kuhn commented on patch set 31 07/23/24, 19:30

    Reply

    yes. that's the only option to get this right & compatible.
  14. Christian Kuhn commented on patch set 31 07/23/24, 19:34

    ActionController.php:490 Reply

    yes. the request handling will be a separate patch. A WIP is found at https://review.typo3.org/c/Packages/TYPO3.CMS/+/85267 . This will see a rebase very soon since we had to change some things within fluid again - the first idea did not work out. However, finishing this patch will be the next main topic.
  15. core-ci voted on patch set 31 V +1 07/23/24, 19:38 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/62041

  16. Christian Kuhn uploaded patch set 32 V +1 07/23/24, 19:44

  17. Christian Kuhn commented on patch set 31 07/23/24, 19:44

    FluidViewAdapter.php:23 Reply

    Done

    FluidViewAdapter.php:217 Reply

    Done
  18. core-ci voted on patch set 32 V +1 07/23/24, 19:49 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/62042

  19. Simon Praetorius voted on patch set 32 CR +1 V +1 07/23/24, 20:13

  20. Hannes Lau voted on patch set 32 CR +1 07/23/24, 20:52

  21. Georg Ringer voted on patch set 32 CR +1 V +1 07/24/24, 05:15

  22. Benni Mack voted on patch set 32 CR +1 V +1 07/24/24, 06:24

  23. Benni Mack commented on patch set 32 CR +2 V +2 07/24/24, 06:24

    this is very very nice to see that we slowly decouple Extbase from EXT:fluid from EXT:core from Fluid Standalone
  24. Benni Mack merged patch set 33 07/24/24, 06:24

  25. Christian Kuhn voted on patch set 33 CR +1 V +1 07/24/24, 06:43