Review main Abandoned

84372[FEATURE] Add PSR-14 Event for modifying FluidEmail before rendering

Michael Bakonyi CR 0 V 0 Normal +114 −2 updated 03/27/26, 07:38

Commit message

A new PSR-14 Event is being introduced which allows extensions to modify
a FluidEmail before its content is rendered. The Event is being
dispatched before the rendering of StandaloneView takes place.

This makes it possible to alter both the email object and its view by
e.g. assigning custom Fluid variables, change the request etc.

Review

  • Code review CR 0
  • Verified V 0
    • core-ci +1 CI

Issues 1

Files 3

Review log 1724

  1. Michael Bakonyi uploaded patch set 1 05/23/24, 07:15

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

  3. Simon Schaufelberger uploaded patch set 2 V -1 07/12/24, 00:11

  4. Simon Schaufelberger uploaded patch set 3 07/12/24, 00:14

  5. core-ci voted on patch set 2 V -1 07/12/24, 00:18 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/61426

  6. core-ci voted on patch set 3 V +1 07/12/24, 00:19 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/61427

  7. Anja Leichsenring voted on patch set 3 CR +1 V +1 07/31/24, 18:08

  8. Georg Ringer commented on patch set 4 CR +1 V +1 08/01/24, 04:18

    Published edit on patch set 3.
  9. Georg Ringer voted on patch set 4 CR +1 V +1 08/01/24, 04:18

  10. core-ci voted on patch set 4 V +1 08/01/24, 04:23 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/62571

  11. Guido Schmechel voted on patch set 4 CR +1 08/18/24, 11:52

  12. Garvin Hicking commented on patch set 4 09/05/24, 16:03

    Unresolved

    Needs rebasing with new Fluid StandaloneViewFactory concept. I'd love to get this in before Feature freeze.
  13. Garvin Hicking commented on patch set 4 09/05/24, 16:05

    Unresolved

    Also we'd need at least a small test for this like the other events (can provide one hopefully next week)
  14. Simon Praetorius uploaded patch set 5 CR +1 V +1 09/06/24, 10:58

  15. Simon Praetorius uploaded patch set 6 09/06/24, 11:01

  16. Simon Praetorius uploaded patch set 7 09/06/24, 11:03

  17. Simon Praetorius commented on patch set 7 09/06/24, 11:06

    General thoughts: I'm not sure if it's wise to build more stuff on top of this class. It's currently one of the few places in the Core that still has a hard dependency on Fluid, so there will probably new API in the near future that is more View-agnostic. So I would argue to define a more view-agnostig event by not providing the FluidEmail to the event and by naming it differently. But I guess that defeats most of the purpose of this patch?
  18. core-ci voted on patch set 6 V -1 09/06/24, 11:10 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/64943

  19. core-ci voted on patch set 5 V -1 09/06/24, 11:11 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/64942

  20. core-ci voted on patch set 7 V +1 09/06/24, 11:11 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/64944

  21. Stefan Bürk commented on patch set 7 09/06/24, 18:31

    Reply

    I disagree here. Passing the view in the event should be avoided and only pass the FluidEmail instance. From the naming this class should be Fluid bound. For a view implementation acconistic version we should introduce a new *Mail class instead. Beside that, the event is dispatched for eacht format rendering (for the same mail object) - that means, that a event eventually adds the same thing over and over again. In special, if something calls a method which resets a already rendered state and leading to rerendering. On top of that, I really doubt that the "FluidMail" instance (or even the view) is to less context in the event - except if the event should be used to do something in generall and not for specific mails etc. Places creating a mail should dispatch a event with context information - which also counts for 3rd party code. So kind of a factory is more conveniant getting the context data and dispatching a event instead of this one. Not blocking this event in general, but the view instance should be removed.
  22. Simon Praetorius commented on patch set 7 09/07/24, 17:12

    Reply Unresolved

    Ok, that's the other option: Defining an event that will also in the future only work for Fluid-based emails. Also fine by me. And yes, then it makes sense to attach only FluidEmail to the event and not the internal view, as it can be modified by FluidEmail anyways.
  23. Garvin Hicking commented on patch set 7 03/13/26, 08:52

    I'm just revisiting this. I think you could use the existing `BeforeMailerSentMessageEvent` PSR-14 event to actually do all of this. But I may be missing something ... :D
  24. Garvin Hicking abandoned the change 03/27/26, 07:38

    No further feedback, abandoning with feedback above