Project

General

Profile

Actions

Bug #105197

closed

ElementInformationController preview url uses wrong language

Added by Filipe DA COSTA about 2 months ago. Updated 4 days ago.

Status:
Resolved
Priority:
Should have
Assignee:
-
Category:
Localization
Target version:
-
Start date:
2024-10-04
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
12
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

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()

Actions

Also available in: Atom PDF