Commit 68fdc5f1 authored by Benni Mack's avatar Benni Mack
Browse files

[TASK] Only show "Localize to" if there are elements to localize

To further improve the recordlist UI, the "Localize to" column
is not longer shown, in case there are no more records to localize.

Resolves: #94794
Releases: master
Change-Id: Ib08508a25a6eac677d92b3b4f539d7ee4e84c1c1
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/70403

Tested-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Reviewed-by: Thomas Löffler's avatarThomas Löffler <loeffler@spooner-web.de>
Reviewed-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
parent da0aadf3
......@@ -424,6 +424,8 @@ class DatabaseRecordList
*/
protected array $backendUserCache = [];
protected array $showLocalizeColumn = [];
protected EventDispatcherInterface $eventDispatcher;
public function __construct(
......@@ -1103,7 +1105,10 @@ class DatabaseRecordList
$theData[$fCol] = $this->languageFlag($table, $row);
// Localize record
$localizationPanel = $translationEnabled ? $this->makeLocalizationPanel($table, $row, $translations) : '';
$theData[$fCol . 'b'] = '<div class="btn-group">' . $localizationPanel . '</div>';
if ($localizationPanel !== '') {
$theData['_LOCALIZATION_b'] = '<div class="btn-group">' . $localizationPanel . '</div>';
$this->showLocalizeColumn[$table] = true;
}
} elseif ($fCol !== '_LOCALIZATION_b') {
// default for all other columns, except "_LOCALIZATION_b"
$pageId = $table === 'pages' ? $row['uid'] : $row['pid'];
......@@ -1235,12 +1240,14 @@ class DatabaseRecordList
$theData[$fCol] = '<i>[' . htmlspecialchars($lang->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels._REF_')) . ']</i>';
break;
case '_LOCALIZATION_':
// Path
// Show language of record
$theData[$fCol] = '<i>[' . htmlspecialchars($lang->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels._LOCALIZATION_')) . ']</i>';
break;
case '_LOCALIZATION_b':
// Path
$theData[$fCol] = htmlspecialchars($lang->getLL('Localize'));
// Show translation options
if ($this->showLocalizeColumn[$table] ?? false) {
$theData[$fCol] = htmlspecialchars($lang->getLL('Localize'));
}
break;
default:
// Regular fields header:
......
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