Review main Merged

89199[BUGFIX] Improve page module for multi-site instances

André Buchmann CR +2 V +2 Normal +47 −29 updated 04/30/25, 20:13

Commit message

This patch improves the page module for multi-site instances:

- Keeps the selected language when switching between
  pages within the same site.
- Shows the default language content if no translation exists,
  without preselecting a language in the switcher.
- Resets to the default language when switching to another site
  where the selected language is not available.
- Prevents empty page rendering by falling back to the default
  language in BackendLayoutRenderer when not in "language" mode.
- Does not add -1 in case no translations exist
- Does not persist any broken state

Review

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

Issues 2

Files 2

Review log 2127

Show 12 earlier messages
  1. André Buchmann uploaded patch set 1 04/22/25, 20:41

  2. core-ci voted on patch set 1 V +1 04/22/25, 20:47 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/78039

  1. Kevin Rüdger voted on patch set 1 V +1 04/23/25, 08:10

  2. Kevin Rüdger voted on patch set 1 CR +1 04/23/25, 08:12

  3. anonymized-98012 voted on patch set 1 CR +1 04/23/25, 08:14

  4. anonymized-98012 voted on patch set 1 V +1 04/23/25, 08:15

  5. Benni Mack commented on patch set 1 04/23/25, 08:42

    PageLayoutController.php:224

    we had a similar issue / pending review in the past. If you switch to language comparison mode, click on the ONE page where you don't have a translation yet, TYPO3 switched to "layout" mode, and sticks to it (as it is stored in the moduleData persistently) and then the editor has to manually switch back all the time.
  6. André Buchmann commented on patch set 1 04/23/25, 10:01

    PageLayoutController.php:224 Reply

    Tested it again. Can't confirm that the mode is permanently switched to "layout". Only the selected language is changed from a translation (>= 1) to default (0). When -1 is selected, it stays at -1. Tested switching between a non-translated page in the multi-language site and the translated pages. And also between the described sites. The language change from translation to 0 happens with and without my patch.
  7. André Buchmann uploaded patch set 2 CR +1 V +1 04/23/25, 10:08

  8. core-ci voted on patch set 2 V +1 04/23/25, 10:14 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/78058

  9. André Buchmann commented on patch set 2 04/23/25, 10:21

    PageLayoutController.php:224 Reply

    @benni@typo3.org I think I've found a better place to fix the issue. Adding the fallback to the BackendLayoutRenderer doesn't change any user settings. Alternatively we can implement the language check here, as the $viewMode is also determined there: https://github.com/typo3/typo3/blob/main/typo3/sysext/backend/Classes/Controller/PageLayoutController.php#L166-L170
  10. Benni Mack commented on patch set 2 04/24/25, 10:26

    PageLayoutController.php:224 Reply

    I do like this change very much. Can you ping @rothjochen@gmail.com to maybe add a Playwright test case with it?
  11. Oli Bartsch commented on patch set 2 04/24/25, 19:34

    BackendLayoutRenderer.php:131

    I would be interested why we are in layout mode with L=-1 in the first place as this is technically not correct. I know how to achieve this in the UI but this should be fixed on the fly same as switching the mode. While this patch works well this way, we should try to fix all this "mode" und "function" handling on switching between sites with different language settings in a whole. See for example: https://forge.typo3.org/issues/97038, https://forge.typo3.org/issues/98058 or https://forge.typo3.org/issues/95308. See also https://github.com/TYPO3/typo3/blob/main/typo3/sysext/backend/Classes/Controller/PageLayoutController.php#L225 where this "problem" seems to be tackled already - but maybe misses some details.
  12. André Buchmann uploaded patch set 3 V +1 04/29/25, 08:11

  13. core-ci voted on patch set 3 V -1 04/29/25, 08:17 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/78330

  14. Oli Bartsch uploaded patch set 4 V -1 04/29/25, 11:41

  15. core-ci voted on patch set 4 V +1 04/29/25, 11:48 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/78348

  16. André Buchmann commented on patch set 4 04/29/25, 12:34

    PageLayoutController.php:224 Reply

    Heyho @benni@typo3.org Jochen and I talked about the implementation of playwright tests for this fix. Currently the setup for the playwright tests has no multilingual sites and missing site configs etc. I think we should create a followup task to create a multisite and multilingual setup to test the pagelayout modes and many other translation related features, like the translation wizard etc. Are you fine with merging this patch without playwright tests now?

    BackendLayoutRenderer.php:131 Reply

    Thanks for your time and improvement of the patch. As we discussed, the refactoring of the menuConfig method tackles the issue. Also to prevent errors when the backend layout renderer is called from elsewhere, we keep the added fallback logic there also.
  17. Oli Bartsch updated the commit message in patch set 5 V +1 04/29/25, 13:55

  18. Oli Bartsch commented on patch set 5 CR +1 V +1 04/29/25, 13:55

    PageLayoutController.php:224 Reply

    Fine for me.
  19. Oli Bartsch updated the commit message in patch set 6 CR +1 V +1 04/29/25, 13:58

  20. Oli Bartsch voted on patch set 6 CR +1 V +1 04/29/25, 13:58

  21. core-ci voted on patch set 5 V +1 04/29/25, 14:02 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/78354

  22. core-ci voted on patch set 6 V +1 04/29/25, 14:04 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/78355

  23. Benni Mack commented on patch set 6 CR +1 V +1 04/30/25, 19:56

    PageLayoutController.php:224 Reply

    Done
  24. Oli Bartsch voted on patch set 6 CR +2 V +2 04/30/25, 20:13

  25. Oli Bartsch merged patch set 7 04/30/25, 20:13