Review main Abandoned

92244[FEATURE] Introduce PSR-14 event to modify language menu

Chris Müller CR 0 V 0 Normal +132 −1 updated 03/26/26, 18:12

Commit message

Using the "language-menu" data processor, there are some edge cases
that need special handling.

- You have a detail record in one language but not translated to
  another language. In this case, the link in the language menu will
  cause a 404 error.
- You have paginated pages, and the number of pages differs depending
  on the language and the number of translated records. The last page
  of one language may link to the last page of another language, which
  may not exist.

The patch introduces the PSR-14 event "ModifyLanguageMenuEvent", which
can be used to adjust the generated menu configuration.

Review

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

Issues 1

Files 3

Review log 1723

  1. Chris Müller uploaded patch set 1 01/03/26, 15:40

  2. core-ci voted on patch set 1 V -1 01/03/26, 15:47 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/92911

  3. Chris Müller uploaded patch set 2 V -1 01/03/26, 15:57

  4. core-ci voted on patch set 2 V +1 01/03/26, 16:05 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/92912

  5. Chris Müller uploaded patch set 3 V +1 01/05/26, 08:02

  6. Chris Müller updated the commit message in patch set 4 01/05/26, 08:18

  7. core-ci voted on patch set 3 V -1 01/05/26, 08:33 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/92965

  8. core-ci voted on patch set 4 V +1 01/05/26, 08:39 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/92972

  9. Chris Müller uploaded patch set 5 V +1 01/05/26, 18:00

  10. Chris Müller uploaded patch set 6 01/05/26, 18:02

  11. core-ci voted on patch set 5 V +1 01/05/26, 18:09 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/93003

  12. core-ci voted on patch set 6 V +1 01/05/26, 18:10 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/93004

  13. Simon Schaufelberger commented on patch set 6 01/05/26, 19:16

    ModifyLanguageMenuEvent.php:45

    instead of a public property, other events use getter and setter. shall we unify this here as well? otherwise it's a mess as it's done here like this and in other places different.
  14. Chris Müller commented on patch set 6 01/05/26, 19:22

    ModifyLanguageMenuEvent.php:45 Reply

    I already saw new events using public properties, so I opted also for this to keep the code small. Example: https://github.com/TYPO3/typo3/blob/main/typo3/sysext/backend/Classes/Authentication/Event/PasswordHasBeenResetEvent.php
  15. Thomas Hohn commented on patch set 6 01/13/26, 07:13

    Feature-108591-IntroducePSR-14EventToModifyLanguageMenu.rst:45 Unresolved

    Remove space after !
  16. Garvin Hicking commented on patch set 6 01/13/26, 07:23

    ModifyLanguageMenuEvent.php:45 Reply Unresolved

    I think since the public property holds an array, a getter and setter might be actually beneficial, because it would allow us to treat/inspect the array before setting or getting it via guards in the event. (Note - I think it's fine that some newer events lean towards getter/setterless access, but only for strictly typed simple Properties, i.e. not just array shapes in phpdoc)
  17. Benni Mack commented on patch set 6 01/13/26, 08:00

    LanguageMenuProcessor.php:367 Unresolved

    we could hook into the HMENU special = language processing and do it there... all of the json_encode / decode procedure sounds unnecessary in general?
  18. Stefan Bürk commented on patch set 6 01/23/26, 00:49

    Do we really need a event here ? The event passes the whole build menu before returning it. Instead of adding a event and implement a event lister, a custom DataProcessor can be made and added into a chain after the LanguageMenu retrieving the processed menu and doing the same thing as in the PSR-14 event. That's the reason of having chained DataProcessors - to work on the result from the previous. Or not ?
  19. Benni Mack commented on patch set 6 01/23/26, 07:55

    Reply

    with the prework that have been merged now, I thought about having an event in HMENU (->getMenuItems()) after the menu items have been compiled to modify them.
  20. Benni Mack commented on patch set 6 03/26/26, 17:05

    Reply Unresolved

    ping Chris, how to proceed?
  21. Chris Müller commented on patch set 6 03/26/26, 18:11

    Sorry, currently no time/interest to push this further.
  22. Chris Müller commented on patch set 6 03/26/26, 18:12

    Will abandon it.
  23. Chris Müller abandoned the change 03/26/26, 18:12