Skip to content
Snippets Groups Projects
Commit 3914e7aa authored by Oliver Bartsch's avatar Oliver Bartsch
Browse files

[BUGFIX] Respect TSconfig when adding page translations to recordlist

Since #27471 it's possible to hide all or specific tables within
the recordlist. However, the special "page translations" table
did not respect those settings, making it impossible to hide
this table.

This is now fixed by respecting the corresponding settings.

Resolves: #94386
Releases: master, 10.4
Change-Id: I33575624ade9ecf840b6fde713a7d3214d6506be
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/69535


Tested-by: default avatarcore-ci <typo3@b13.com>
Tested-by: default avatarBenni Mack <benni@typo3.org>
Tested-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: default avatarJochen <rothjochen@gmail.com>
Tested-by: default avatarOliver Bartsch <bo@cedev.de>
Reviewed-by: default avatarBenni Mack <benni@typo3.org>
Reviewed-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: default avatarJochen <rothjochen@gmail.com>
Reviewed-by: default avatarOliver Bartsch <bo@cedev.de>
parent ceebe9b6
Branches
Tags
No related merge requests found
......@@ -265,18 +265,20 @@ class RecordListController
$beforeOutput = '';
$output = '';
// Show the selector to add page translations and the list of translations of the current page
// but only when in "default" mode
// Show the selector to add page translations, but only when in "default" mode.
// If not disabled via module TSconfig and the user is allowed, also show the page translations table.
if ($this->id && !$search_field && !$cmd && !$table) {
$beforeOutput .= $this->languageSelector($request->getAttribute('normalizedParams')->getRequestUri());
$pageTranslationsDatabaseRecordList = clone $dblist;
$pageTranslationsDatabaseRecordList->listOnlyInSingleTableMode = false;
$pageTranslationsDatabaseRecordList->disableSingleTableView = true;
$pageTranslationsDatabaseRecordList->deniedNewTables = ['pages'];
$pageTranslationsDatabaseRecordList->hideTranslations = '';
$pageTranslationsDatabaseRecordList->setLanguagesAllowedForUser($this->siteLanguages);
$pageTranslationsDatabaseRecordList->showOnlyTranslatedRecords(true);
$output .= $pageTranslationsDatabaseRecordList->getTable('pages', $this->id);
if ($this->showPageTranslations()) {
$pageTranslationsDatabaseRecordList = clone $dblist;
$pageTranslationsDatabaseRecordList->listOnlyInSingleTableMode = false;
$pageTranslationsDatabaseRecordList->disableSingleTableView = true;
$pageTranslationsDatabaseRecordList->deniedNewTables = ['pages'];
$pageTranslationsDatabaseRecordList->hideTranslations = '';
$pageTranslationsDatabaseRecordList->setLanguagesAllowedForUser($this->siteLanguages);
$pageTranslationsDatabaseRecordList->showOnlyTranslatedRecords(true);
$output .= $pageTranslationsDatabaseRecordList->getTable('pages', $this->id);
}
}
// search box toolbar
......@@ -699,6 +701,22 @@ class RecordListController
));
}
protected function showPageTranslations(): bool
{
if (!$this->getBackendUserAuthentication()->check('tables_select', 'pages')) {
return false;
}
if (isset($this->modTSconfig['pages.']['hideTable'])) {
return !$this->modTSconfig['pages.']['hideTable'];
}
$hideTables = $this->modTSconfig['hideTables'] ?? '';
return ($GLOBALS['TCA']['pages']['ctrl']['hideTable'] ?? false)
&& $hideTables !== '*'
&& !in_array('pages', GeneralUtility::trimExplode(',', $hideTables), true);
}
protected function htmlResponse(string $html): ResponseInterface
{
$response = $this->responseFactory->createResponse()
......
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