Issue Bug Closed

#105197ElementInformationController preview url uses wrong language

Filipe DA COSTA 10/04/24, 12:59 updated 12/02/25, 14:32

Description

In the Filelist when looking at file information, we list the records linked to a specific file in the “References to this item” section.
For page records we have the “View webpage” action that loads the page in a new window.

If the page is a translation, the generated URL on that action is wrong. It should be “ domain.tdl/de/german-page “ but instead it tries to open “ domain.tdl/fr/german-page “ (fr is default langage)
In other parts of the backend the URL resolving works correctly, it’s only in Filelist.

Main issue seems be in ElementInformationController.php#L494 where we don’t pass the record language to PreviewUriBuilder:

            $previewUriBuilder = PreviewUriBuilder::create((int)$uid)
                ->withRootLine(BackendUtility::BEgetRootLine($uid));

I’ve tested by retrieving the record and pass the language and it works:

$record = BackendUtility::getRecord($table, $uid);
$previewUriBuilder = PreviewUriBuilder::create((int)$uid)
->withLanguage($record['sys_language_uid'])
->withRootLine(BackendUtility::BEgetRootLine($uid));

But to avoid all those queries, we could change ElementInformationController::getRecordActions() to pass the $row[‘sys_language_uid’] that we already have in ElementInformationController::makeRef()/makeRefFrom()

Reviews 3

History 413

  1. Garvin Hicking commented and changed category status New Needs Feedback 10/04/24, 19:03

    Would you like to contribute this as a patch maybe? Your code above looks like a approach proper to me. Thanks for helping!

  2. Filipe DA COSTA commented 10/07/24, 07:20

    Garvin Hicking wrote in #note-1:
    > Would you like to contribute this as a patch maybe? Your code above looks like a approach proper to me. Thanks for helping!

    Yes, will do

  3. Gerrit Code Review pushed patch set 1 for main to change 86447 status Needs Feedback Under Review 10/07/24, 13:04

  4. Gerrit Code Review pushed patch set 2 for main to change 86447 10/07/24, 14:53

  5. Gerrit Code Review pushed patch set 3 for main to change 86447 10/07/24, 14:58

  6. Gerrit Code Review pushed patch set 4 for main to change 86447 10/18/24, 14:00

  7. Gerrit Code Review pushed patch set 5 for main to change 86447 10/24/24, 09:43

  8. Gerrit Code Review pushed patch set 6 for main to change 86447 10/25/24, 09:10

  9. Gerrit Code Review pushed patch set 7 for main to change 86447 11/15/24, 16:30

  10. Gerrit Code Review pushed patch set 1 for 13.4 to change 87013 11/18/24, 10:12

  11. Gerrit Code Review pushed patch set 1 for 12.4 to change 87014 11/18/24, 10:12

  12. Filipe DA COSTA commented and changed status Under Review Resolved done 0 % 100 % 11/18/24, 10:15

    Applied in changeset commit:f25496504a2d714f994a602fe43160d2dcabf7d9.

  13. Benni Mack changed status Resolved Closed 12/02/25, 14:32