Review main Merged

86262[TASK] Move FluidViewAdapter to EXT:fluid

Benjamin Franzke CR +2 V +2 Easy +24 −16 updated 10/14/24, 14:14

Commit message

The fluid view adapter depends on rendering
context from EXT:fluid, therefore it's better
to be provided by EXT:fluid itself.

While FluidViewAdapter has not been documented as API, an alias is
provided via ClassAliasMap.php, in case instanceof checks have been
used by 3rd party extensions. Also the implementations of the
core view interface are now marked as internal.

Review

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

Issues 1

Files 14

Review log 2027

Show 12 earlier messages
  1. Benjamin Franzke uploaded patch set 1 09/23/24, 08:45

  2. core-ci voted on patch set 1 V +1 09/23/24, 08:50 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/66426

  1. Benjamin Franzke uploaded patch set 2 V +1 09/23/24, 09:18

  2. core-ci voted on patch set 2 V +1 09/23/24, 09:23 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/66427

  3. Benjamin Franzke uploaded patch set 3 V +1 10/07/24, 08:33

    Resolve Merge-Conflict
  4. core-ci voted on patch set 3 V +1 10/07/24, 08:50 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/67211

  5. Christian Kuhn commented on patch set 3 10/11/24, 09:25

    FluidViewFactory.php:36

    is this still a good idea? this means the alias will be registered as soon as the package exists. what happens when a second packages does this too? does it throw, or what is the precedence then? with the class being within ext:core, that question was not very important, but is of interest when moved to a different package.
  6. Stefan Bürk uploaded patch set 4 V +1 10/11/24, 17:40

  7. Stefan Bürk commented on patch set 3 10/11/24, 17:41

    FluidViewFactory.php:36 Reply

    That's a question of ordering. If the ext:fluid is loaded, the other extension wants to replace the default implementation it must have "fluid" as require or as suggest (composer.json) or depend/suggest in ext_emconf.php (legacy mode). ``` #[AsAlias(ViewFactoryInterface::class, public: true)] class CustomFluidViewFactory implements ViewFactoryInterface {} ``` That worked already when this was in EXT:core and with this change also. Could also be done within a Services.php checking if a service has already been registered, and decide to add the costum on eiter as "default" alias or as decorating one - not aware how to make that conditional with phpattributes (existing). A decorating view factory of the interface would reciev the prior service as part of the constructor, so it can be used to make a fallback to the original one. ``` #[AsDecorator(decorates: ViewFactoryInterface::class, priority: 10, onInvalid: ContainerInterface::NULL_ON_INVALID_REFERENCE)] class CustomFluidViewFactory implements ViewFactoryInterface { public function __construct( private RenderingContextFactory $renderingContextFactory, private ?ViewFactoryInterface $previousViewFactory = null, ) {} public function create(ViewFactoryData $data): ViewInterface { $useDefaultFactory = false; //$useDefaultFactory = true; if ($useDefaultFactory) { if ($this->previousViewFactory === null) { throw new \RuntimeException('no decoracted prior service', 1728668089); } return $this->previousViewFactory->create($data); } $pathTuple = []; if (!empty($data->templateRootPaths)) { $pathTuple['templateRootPaths'] = $data->templateRootPaths; } if (!empty($data->layoutRootPaths)) { $pathTuple['layoutRootPaths'] = $data->layoutRootPaths; } if (!empty($data->partialRootPaths)) { $pathTuple['partialRootPaths'] = $data->partialRootPaths; } $renderingContext = $this->renderingContextFactory->create($pathTuple, $data->request); if ($data->templatePathAndFilename) { $renderingContext->getTemplatePaths()->setTemplatePathAndFilename($data->templatePathAndFilename); } if ($data->format) { // @todo: We may want to hand this over to RenderingContextFactory // and set up TemplatePaths() with the format correctly already? $renderingContext->getTemplatePaths()->setFormat($data->format); } $view = new TemplateView($renderingContext); return new FluidViewAdapter($view); } } ```
  8. Stefan Bürk commented on patch set 4 10/11/24, 17:44

    FluidViewFactory.php:36 Reply

    There is also a `#[AutowireDecorated()]` attribute to define in the constructor where the previous service should be added. And the AsDecorator has also multiple ways, not going into detail here. Just answering it will work.
  9. core-ci voted on patch set 4 V +1 10/11/24, 17:46 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/67613

  10. Christian Kuhn commented on patch set 4 10/12/24, 08:07

    FluidViewFactory.php:36 Reply

    Done
  11. Stefan Bürk commented on patch set 4 10/14/24, 04:42

    Not sure about the ReST file move .. guess needs at least a redirect in the changelog ....
  12. Stefan Bürk uploaded patch set 5 V +1 10/14/24, 04:42

  13. Stefan Bürk uploaded patch set 6 10/14/24, 04:43

  14. Stefan Bürk commented on patch set 5 10/14/24, 04:44

    Reply

    Done
  15. core-ci voted on patch set 6 V +1 10/14/24, 04:50 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/67731

  16. core-ci voted on patch set 5 V +1 10/14/24, 04:51 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/67729

  17. Benni Mack voted on patch set 6 CR +1 V +1 10/14/24, 06:27

  18. Stefan Bürk voted on patch set 6 CR +1 V +1 10/14/24, 07:28

  19. Christian Kuhn commented on patch set 6 CR -1 10/14/24, 08:56

    composer.json:152

    this line is duplicated now.
  20. Benni Mack uploaded patch set 7 CR +1 V +1 10/14/24, 09:23

  21. Benni Mack commented on patch set 7 10/14/24, 09:24

    composer.json:152 Reply

    Done
  22. core-ci voted on patch set 7 V +1 10/14/24, 09:31 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/67746

  23. Christian Kuhn voted on patch set 7 CR +1 V +1 10/14/24, 14:14

  24. Stefan Bürk voted on patch set 7 CR +2 V +2 10/14/24, 14:14

  25. Stefan Bürk merged patch set 8 10/14/24, 14:14