Review main Abandoned

84514[BUGFIX] Only render working links in language menu

Yannis Viol CR 0 V -1 Hard +375 −2 updated 11/10/26, 10:42

Commit message

Update route handler to only respect configured routes if the l18n_cfg
is set to "Hide page if no translation for current language exists".
Because the default route always generates a non rewritten link
to the detail page if an element doesn't exist.
Check if the language has a link to mark it
as available in the Language Menu.
Add PageRouterTest.php which tests the generateUri functionality of
the PageRouter to ensure that the previous changes work as expected.

Review

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

Issues 1

Files 4

Review log 2538

Show 913 earlier messages
  1. Yannis Viol uploaded patch set 1 06/06/24, 15:22

  2. core-ci voted on patch set 1 V -1 06/06/24, 15:37 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58811

  3. Yannis Viol rebased onto patch set 2 V -1 06/06/24, 16:03

  4. core-ci voted on patch set 2 V -1 06/06/24, 16:07 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58816

  5. Yannis Viol uploaded patch set 3 V -1 06/06/24, 16:41

  6. core-ci voted on patch set 3 V +1 06/06/24, 16:47 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58817

  7. Benni Mack commented on patch set 3 06/06/24, 21:12

    PageRouter.php:336

    should we use PageTranslationVisibility instead?
  8. Yannis Viol uploaded patch set 4 V +1 06/07/24, 06:31

  9. core-ci voted on patch set 4 V +1 06/07/24, 06:36 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58847

  10. Astrid Haubold commented on patch set 4 CR -1 06/07/24, 17:22

    PageRouter.php:335

    I tested this and I'm afraid, it doesn't solve the issue any more: $pageTranslationVisibility->shouldHideTranslationIfNoTranslatedRecordExists() seems to always be FALSE, the invalid links are still displayed. The original code works.
  11. Stefan Bürk commented on patch set 4 06/07/24, 20:44

    Unresolved

    I'd suggest to create test(s) first for Language Menu and normal link handling, to cover that case and guard existing stuff. For normal pages and routes with record like definitions (not page records only) aka "detail page if an element doesn't exists".
  12. Astrid Haubold commented on patch set 4 06/14/24, 11:58

    PageRouter.php:335 Reply

    To specify: it only seems to work with $GLOBALS['TYPO3_CONF_VARS']['FE']['hidePagesIfNotTranslatedByDefault'] = true; With that setting language fallback for pages cannot be used any more though. We discussed this in the initiative and we think the language menu record links should not be depending on this setting. Also we agree with Stefan in that tests should be written first for all possible scenarios.
  13. Astrid Haubold commented on patch set 4 CR 0 06/21/24, 06:40

    PageRouter.php:335 Reply

    Sorry, works with "Hide page if no translation for current language exists" set for the current page.
  1. Yannis Viol uploaded patch set 5 V +1 07/19/24, 12:33

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

  3. Yannis Viol uploaded patch set 6 V -1 07/19/24, 13:07

  4. core-ci voted on patch set 6 V -1 07/19/24, 13:15 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/61826

  5. Yannis Viol uploaded patch set 7 V -1 07/19/24, 13:22

  6. core-ci voted on patch set 7 V -1 07/19/24, 13:29 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/61827

  7. Yannis Viol uploaded patch set 8 V -1 07/19/24, 13:55

  8. core-ci voted on patch set 8 V -1 07/19/24, 14:02 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/61832

  9. Yannis Viol uploaded patch set 9 V -1 07/19/24, 14:05

  10. core-ci voted on patch set 9 V -1 07/19/24, 14:12 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/61833

  11. Yannis Viol uploaded patch set 10 V -1 07/19/24, 14:20

  12. core-ci voted on patch set 10 V -1 07/19/24, 14:26 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/61835

  13. Yannis Viol uploaded patch set 11 V -1 07/19/24, 14:39

  14. core-ci voted on patch set 11 V +1 07/19/24, 14:44 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/61836

  15. Astrid Haubold voted on patch set 11 V +1 07/26/24, 16:18

  16. Stefan Bürk commented on patch set 11 CR -1 07/30/24, 13:07

    Unresolved

    The test structure should be changed towards proper DataProvider usages and build up, specifing expectation and test data with the DataProvider entries instead of building weired test cases out of the "imported" database records. On top of that, as also mentioned in other comments - this tests a) only on lowlevel and b) not really having a real extension record table (TCA mangages, workspace aware and and and. So instead of creating a table with plain SQL DDL it's more advicable to create a test fixture extension providng a record along with all configuration a extension would do - and be used within a real instance and routing. The build up does not reflect a real extension and record. On top of that, more highlevel link generation (with a proper record-linkhandler configuration should also be done and included - which tests where the reported issue orignates from and the "fix" is provided. Beside that, and I know it may be extensive - already a big thanks for providing a solution suggestion AND took the time to add test coverage albeit not beeing into it. I commented that for now here, and will put a -1 on it. As already offered, I'm open to have a call with you @yvi@rtp.ch next week after the Developer Days to go through these things or solve questions.

    PageRouterTest.php:56 Unresolved

    You create a table here, but this is not TCA managed. The whole system and router is based on TCA, and you want to "simulate/test" record based linkhandling - which does not make sense. We usualy create test fixture extensions for that - with the TCA, table definition (most likely not needed in v13 anymore due to TCA type autocreation) etc and load it as "$testExtensionToLoad = []". And even if not, this statement is not really cross-db safe - at least Dotrine DBAL Schema classes needs to be used and the "migrator" to create the data - or better, the core internal database analyzer stack !!! so everything is created like it would be for an extension.

    PageRouterTest.php:155 Unresolved

    In the testing word and also in core, a "test" method itself is the test which is executed. If different sets of data needs to be checked a DataProvider should be implemented, handing over the data needed to "setup" and "execute" code along with the expectation. (PHPUnit DataProviders). See also other tests with `#[DataProvider]` as examples.

    PageRouterTest.php:177 Unresolved

    Don't create "test cases" from "database base records". That should be provided as DataProvider what exactly to test. Kind of a "list" which "links" should be created aka detail page id / record id etc and the expectation on that. This test build up makes it really hard to grasp which datasets are really "tested" and cannot just "read up". The test case should be refactored and streamlined. Please look into other tests.

    PageRouterTest.php:295 Unresolved

    This whole test-case and single test only tests the absolutly "lowlevel" on the router part. However, readong from the issue I'd say this is only a part. We should also tests this from more highlevel stuff, for example TypoScript, Fluid Viewhelpers, ContentObjectRender and simuialr - and at least partly with a real frontend request and not only the "raw router" as component.

    PageRouterTest.php:297 Unresolved

    One test execution should test one testcase - which should be provided by a DataProvider - and not this kind of test build up. See comments above, needs to be refactored.

    PageRouterTest.php:309 Unresolved

    No `named arguments` here please. The core (team) has etablished rules around named arguments for the core (and recommendations for project/extension authors) which can be read up here -> https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/CodingGuidelines/CodingBestPractices/NamedArguments.html#named-arguments Note if this was a copy&paste - we had some named arguments before the rule was made, but also stated that no "active" revert should be done.
  17. Benni Mack updated the commit message in patch set 12 CR -1 V +1 10/18/24, 13:39

  18. Benni Mack rebased onto patch set 13 03/28/25, 12:14

  19. core-ci voted on patch set 13 V -1 03/28/25, 12:28 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/76579

  20. Benni Mack commented on patch set 13 04/08/25, 10:40

    I wonder why HMENU or PageLinkBuilder do not catch this, because they have this in place already.
  21. Benni Mack wrote 04/21/26, 14:59

    Removed cc Benni Mack.
  22. Benni Mack updated the commit message in patch set 14 V -1 04/22/26, 06:50

  23. core-ci voted on patch set 14 V -1 04/22/26, 11:30 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/100814

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

    PageRouter.php:336 Reply

    Done
  25. Benni Mack abandoned the change 11/10/26, 10:42

    resolved via https://review.typo3.org/c/Packages/TYPO3.CMS/+/88592, closing this one now - issue is already resolved