Preview of a record's translation is not show if parent is hidden
Given the following record set:
- record 1, sys_language_uid=0, hidden=1
- record 2, sys_language_uid=1, l10n_parent=1, hidden=1
Make an extbase plugin which lists the records using an extbase repository, and put this plugin on a page.
In the admin panel I check "show hidden records" and I can preview the record 1 if FE language is 0.
If FE language is 1, I cannot preview the record 2.
If I unhide the record 1, its works: I can see the record 2.
I should be able to preview a hidden record either if it is a base record or a translation, and whatever the hidden status of the base record is.
Explanation and fix proposal
The issue resides in Typo3DbQueryParser::addTypo3Constraints() which uses a doctrine query builder in order to add the additional where clause related to localization handling (content fallback + hideNonTranslated).
But the query builder is using the DefaultRestrictionContainer, which does not check the Visibility aspect at all when building the expressions.
In order to fix the issue, Typo3DbQueryParser must check for frontend mode, and set FrontendRestrictionContainer instead of DefaultRestrictionContainer in the needed query builders.