Issue Bug New Regression

#111635TCEMAIN.preview.<table>.useDefaultLanguageRecord has no effect

Sebastian Stein 11/27/26, 10:17 updated 11/27/26, 10:20

Description

Since the record preview logic was moved from EditDocumentController to PreviewUriBuilder (#77581,
https://review.typo3.org/c/Packages/TYPO3.CMS/+/89843, released with 13.4.15 and 14.0), the page
TSconfig option TCEMAIN.preview..useDefaultLanguageRecord is ignored. The preview URL of a
translated record always contains the uid of the translation, no matter whether the option is
unset, set to 1 or set to 0.

The documented behaviour (Feature #66370, TSconfig reference) is: useDefaultLanguageRecord defaults
to 1, so translated records use the uid of the default language record. With 0 the uid of the
translation is used. This was already fixed once in #87948 (change 60297, incl. unit tests), the fix
got lost in the refactoring and the tests were removed together with
EditDocumentController::resolvePreviewRecordId().

Steps to reproduce

1. Install EXT:news, create a news record (e.g. uid 76) and translate it (e.g. uid 879).
2. Add page TSconfig:

    TCEMAIN.preview {
        tx_news_domain_model_news {
            previewPageId = 27
            useDefaultLanguageRecord = 1
            fieldToParameterMap {
                uid = tx_news_pi1[news_preview]
            }
            additionalGetParameters {
                tx_news_pi1.controller = News
                tx_news_pi1.action = detail
            }
        }
    }

3. Open the translated news record and click “View”.
4. Repeat with useDefaultLanguageRecord = 0 and with the line removed.

Expected result

useDefaultLanguageRecord tx_news_pi1[news_preview]
not set 76 (default language)
1 76 (default language)
0 879 (translation)

Actual result

tx_news_pi1[news_preview]=879 in all three cases.

Cause

typo3/sysext/backend/Classes/Routing/PreviewUriBuilder.php, getPreviewUrlParameters():

    if (!empty($record[$l10nPointer]) && ($previewConfiguration['useDefaultLanguageRecord'] ?? true) === false) {
        $recordId = (int)$record[$l10nPointer];
    } else {
        $recordId = (int)$record['uid'];
    }
  • TSconfig values are strings (‘0’ / ‘1’), so the strict comparison with false is never true and the
    else branch (uid of the translation) is always taken.
  • The condition is inverted as well: even if the value were false, the default language uid would
    be used, which is the opposite of the documented meaning.

Behaviour before the refactoring (EditDocumentController::resolvePreviewRecordId(), up to 13.4.14):

    if ($l10nPointer
        && !empty($recordArray[$l10nPointer])
        && (
            !isset($previewConfiguration['useDefaultLanguageRecord'])
            || $previewConfiguration['useDefaultLanguageRecord']
        )
    ) {
        return (int)$recordArray[$l10nPointer];
    }
    return (int)$recordArray['uid'];

Possible fix

    if (!empty($record[$l10nPointer]) && (bool)($previewConfiguration['useDefaultLanguageRecord'] ?? true)) {
        $recordId = (int)$record[$l10nPointer];
    } else {
        $recordId = (int)$record['uid'];
    }

Note: Installations that relied on the current (13.4.15+) behaviour without setting the option will
see the default language uid again after the fix, as documented. They need to set
useDefaultLanguageRecord = 0 explicitly.

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

Fix this issue

Start the commit message of your patch with this. Add what the patch does, and the versions it goes to in "Releases:". How to create a patch

Commit message
[BUGFIX] TCEMAIN.preview.<table>.useDefaultLanguageRecord has no effect Resolves: #111635 Releases: main

History 1

  1. Sebastian Stein changed description 11/27/26, 10:20