Commit 2b5d1c81 authored by Gianluigi Martino's avatar Gianluigi Martino Committed by Andreas Fernandez
Browse files

[BUGFIX] Add language parameter to preview url in list module

The language parameter was not set if the "View webpage" button was used
within the context menu of an element in the page module or the
"View webpage" button in the record list of a desired language.

Resolves: #80599
Releases: master, 8.7
Change-Id: I40fb5749cbd56c0075a8aa2c5ec3b2d8dea66501
Reviewed-on: https://review.typo3.org/52341


Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: default avatarReiner Teubner <reiner.teubner@me.com>
Tested-by: default avatarReiner Teubner <reiner.teubner@me.com>
Reviewed-by: Andreas Fernandez's avatarAndreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Andreas Fernandez's avatarAndreas Fernandez <a.fernandez@scripting-base.de>
parent 05e4d107
......@@ -416,12 +416,22 @@ class RecordProvider extends AbstractProvider
*/
protected function getViewLink(): string
{
$anchorSection = $this->table === 'tt_content' ? '#c' . $this->record['uid'] : '';
$anchorSection = '';
$additionalParams = '';
if ($this->table === 'tt_content') {
$anchorSection = '#c' . $this->record['uid'];
$language = (int)$this->record[$GLOBALS['TCA']['tt_content']['ctrl']['languageField']];
if ($language > 0) {
$additionalParams = '&L=' . $language;
}
}
$javascriptLink = BackendUtility::viewOnClick(
$this->getPreviewPid(),
'',
null,
$anchorSection
$anchorSection,
'',
$additionalParams
);
$extractedLink = '';
if (preg_match('/window\\.open\\(\'([^\']+)\'/i', $javascriptLink, $match)) {
......
......@@ -1298,17 +1298,29 @@ class DatabaseRecordList
protected function getOnClickForRow(string $table, array $row): string
{
if ($table === 'tt_content') {
// Link to a content element
$onClick = BackendUtility::viewOnClick($this->id, '', null, '#' . $row['uid']);
// Link to a content element, possibly translated and with anchor
$additionalParams = '';
$language = (int)$row[$GLOBALS['TCA']['tt_content']['ctrl']['languageField']];
if ($language > 0) {
$additionalParams = '&L=' . $language;
}
$onClick = BackendUtility::viewOnClick(
$this->id,
'',
null,
'#c' . $row['uid'],
'',
$additionalParams
);
} elseif ($table === 'pages' && $row[$GLOBALS['TCA']['pages']['ctrl']['transOrigPointerField']] > 0) {
// Link to a page translation
// Link to a page translation needs uid of default language page as id
$onClick = BackendUtility::viewOnClick(
$row[$GLOBALS['TCA']['pages']['ctrl']['transOrigPointerField']],
'',
null,
'',
'',
'&L=' . $row[$GLOBALS['TCA']['pages']['ctrl']['languageField']]
'&L=' . (int)$row[$GLOBALS['TCA']['pages']['ctrl']['languageField']]
);
} else {
// Link to a page in the default language
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment