Skip to content

Commit

Permalink
[BUGFIX] Respect TSconfig when adding page translations to recordlist
Browse files Browse the repository at this point in the history
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: core-ci <typo3@b13.com>
Tested-by: Benni Mack <benni@typo3.org>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Jochen <rothjochen@gmail.com>
Tested-by: Oliver Bartsch <bo@cedev.de>
Reviewed-by: Benni Mack <benni@typo3.org>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Jochen <rothjochen@gmail.com>
Reviewed-by: Oliver Bartsch <bo@cedev.de>
  • Loading branch information
o-ba committed Jun 22, 2021
1 parent ceebe9b commit 3914e7a
Showing 1 changed file with 28 additions and 10 deletions.
38 changes: 28 additions & 10 deletions typo3/sysext/recordlist/Classes/Controller/RecordListController.php
Expand Up @@ -265,18 +265,20 @@ function editRecords(table,idList,addParams,CBflag) {

$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
Expand Down Expand Up @@ -699,6 +701,22 @@ protected function getShortcutTitle(array $arguments): string
));
}

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

0 comments on commit 3914e7a

Please sign in to comment.