Bug #105197
closedElementInformationController preview url uses wrong language
100%
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()