From fbb6367abbc5565c26e72b42169add8b880d4866 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Sat, 15 Apr 2023 19:08:07 +0200 Subject: [PATCH] [FEATURE] Allow to hide teas based on fe_groups (#798) Relates: #555 --- .../TCA/tx_tea_domain_model_product_tea.php | 57 ++++++++++++++++++- .../Private/Language/de.locallang_db.xlf | 8 +++ Resources/Private/Language/locallang_db.xlf | 6 ++ 3 files changed, 70 insertions(+), 1 deletion(-) diff --git a/Configuration/TCA/tx_tea_domain_model_product_tea.php b/Configuration/TCA/tx_tea_domain_model_product_tea.php index 5b3acf0..493d62a 100644 --- a/Configuration/TCA/tx_tea_domain_model_product_tea.php +++ b/Configuration/TCA/tx_tea_domain_model_product_tea.php @@ -10,9 +10,23 @@ $tca = [ 'default_sortby' => 'title', 'iconfile' => 'EXT:tea/Resources/Public/Icons/Record.svg', 'searchFields' => 'title, description', + 'enablecolumns' => [ + 'fe_group' => 'fe_group', + ], ], 'types' => [ - '1' => ['showitem' => 'title, description, image'], + '1' => ['showitem' => ' + --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general, + title, description, image, + --div--;LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_product_tea.tabs.access, + --palette--;;access, + '], + ], + 'palettes' => [ + 'access' => [ + 'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_product_tea.palettes.access', + 'showitem' => 'fe_group', + ], ], 'columns' => [ 'title' => [ @@ -51,6 +65,33 @@ $tca = [ 'allowed' => 'common-image-types', ], ], + 'fe_group' => [ + 'exclude' => true, + 'l10n_mode' => 'exclude', + 'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_product_tea.fe_group', + 'config' => [ + 'type' => 'select', + 'renderType' => 'selectMultipleSideBySide', + 'size' => 7, + 'maxitems' => 20, + 'items' => [ + [ + 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.hide_at_login', + 'value' => -1, + ], + [ + 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.any_login', + 'value' => -2, + ], + [ + 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.usergroups', + 'value' => '--div--', + ], + ], + 'exclusiveKeys' => '-1,-2', + 'foreign_table' => 'fe_groups', + ], + ], ], ]; $typo3Version = new \TYPO3\CMS\Core\Information\Typo3Version(); @@ -87,6 +128,20 @@ if ($typo3Version->getMajorVersion() < 12) { ] ), ]; + $tca['columns']['fe_group']['config']['items'] = [ + [ + 0 => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.hide_at_login', + 1 => -1, + ], + [ + 0 => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.any_login', + 1 => -2, + ], + [ + 0 => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.usergroups', + 1 => '--div--', + ], + ]; } return $tca; diff --git a/Resources/Private/Language/de.locallang_db.xlf b/Resources/Private/Language/de.locallang_db.xlf index 765216f..1c2e058 100644 --- a/Resources/Private/Language/de.locallang_db.xlf +++ b/Resources/Private/Language/de.locallang_db.xlf @@ -7,6 +7,10 @@ Tea Tee + + Access + Zugriff + Title Titel @@ -19,6 +23,10 @@ Image Bild + + Usergroup Access Rights + Zugriffsrechte für Benutzergruppen + diff --git a/Resources/Private/Language/locallang_db.xlf b/Resources/Private/Language/locallang_db.xlf index e593780..9187161 100644 --- a/Resources/Private/Language/locallang_db.xlf +++ b/Resources/Private/Language/locallang_db.xlf @@ -6,6 +6,9 @@ Tea + + Access + Title @@ -15,6 +18,9 @@ Image + + Usergroup Access Rights +