Review main Merged

92995[FEATURE] Add event after page URI generation

Sebastian Michaelsen CR +2 V +2 Normal +219 −8 updated 03/26/26, 19:24

Commit message

Introduce a PSR-14 event after PageRouter::generateUri() to let
extensions inspect context and override generated page URIs.

The event exposes route input, sanitized parameters, fragment,
type, language and site metadata.

Review

  • Code review CR +2 Done
    • Georg Ringer +2
    • Benni Mack +1
  • Verified V +2 Done
    • Georg Ringer +2
    • Benni Mack +1
    • core-ci +1 CI

Issues 1

Files 5

Review log 2128

Show 23 earlier messages
  1. Sebastian Michaelsen uploaded patch set 1 02/25/26, 14:22

  2. Mathias Brodala commented on patch set 1 02/25/26, 14:26

    PageRouter.php:408

    Please put this in the constructor instead.
  3. core-ci voted on patch set 1 V -1 02/25/26, 14:33 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96826

  1. Sebastian Michaelsen commented on patch set 1 02/25/26, 14:50

    PageRouter.php:408 Reply

    That's more difficult than it looks. That makes other unit tests such as PageRouterTest fail. It results in "Cannot instantiate interface Psr\EventDispatcher\EventDispatcherInterface" because those unit tests instantiate PageRouter without a fully bootstrapped DI container (or a pre-registered dispatcher singleton), so resolving EventDispatcherInterface in the constructor happens too early and GeneralUtility::makeInstance() has no concrete implementation to return.
  2. Mathias Brodala commented on patch set 1 02/25/26, 14:54

    PageRouter.php:408 Reply

    Then you'll need to extend the existing mocking accordingly.
  3. Sebastian Michaelsen uploaded patch set 2 V -1 02/25/26, 14:55

  4. Sebastian Michaelsen uploaded patch set 3 02/25/26, 15:03

  5. Sebastian Michaelsen commented on patch set 3 02/25/26, 15:10

    PageRouter.php:408 Reply

    Acknowledged
  6. core-ci voted on patch set 2 V +1 02/25/26, 15:12 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96828

  7. core-ci voted on patch set 3 V +1 02/25/26, 15:45 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96831

  8. Amir Arends commented on patch set 3 02/26/26, 06:48

    Thank you @sebastian@michaelsen.io. It is really very valuable. In our use case, we need to adjust the final URL dynamically based on active campaign, which is only fully available after generation. Currently, this requires a patch, so a dedicated hook or event would make this much cleaner and more maintainable.
  9. Georg Ringer voted on patch set 3 CR +1 V +1 02/27/26, 13:16

  10. Benni Mack commented on patch set 3 CR -2 02/27/26, 13:24

    will be reviewing this thorougly
  11. Sebastian Michaelsen commented on patch set 3 CR -1 03/07/26, 14:42

    AfterPageUriGeneratedEvent.php:28

    This and its getter should be typed `array|string|int|Page` instead of mixed. I'll fix this when I have Benni's feedback.
  12. Sebastian Michaelsen rebased onto patch set 4 CR +1 V +1 03/19/26, 14:48

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  13. Sebastian Michaelsen commented on patch set 4 03/19/26, 14:49

    AfterPageUriGeneratedEvent.php:28 Reply

    Done
  14. Sebastian Michaelsen uploaded patch set 5 03/19/26, 14:49

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  15. core-ci voted on patch set 4 V +1 03/19/26, 15:01 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/98238

  16. core-ci voted on patch set 5 V -1 03/19/26, 15:08 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/98240

  17. core-ci voted on patch set 5 V +1 03/20/26, 09:13 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/98240

  18. Benni Mack commented on patch set 5 CR +1 V +1 03/22/26, 10:24

    this is a very powerful (you know - great power, great responsibility) event. I usually refrain to "AfterLinkIsGeneratedEvent", but this one is obviously needed for other cases.
  19. Benni Mack commented on patch set 5 03/22/26, 10:25

    Reply

    we "could" document this in the RST, that this is affected in more places (also generated from the backend etc)
  20. Sebastian Michaelsen uploaded patch set 6 CR +1 V +1 03/23/26, 11:25

  21. Sebastian Michaelsen commented on patch set 6 03/23/26, 11:27

    Reply

    very valid and helpful remark. to be honest I was not aware of the width of the impact this event might have. I took your comment to investigate which features of TYPO3 can be affected by this and hopefully made the power/responsibility clear in the rst document.
  22. core-ci voted on patch set 6 V +1 03/23/26, 11:38 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/98460

  23. Benni Mack commented on patch set 6 CR +1 V +1 03/26/26, 17:06

    thx!
  24. Georg Ringer voted on patch set 6 CR +2 V +2 03/26/26, 19:24

  25. Georg Ringer merged patch set 7 03/26/26, 19:24