From 2484f6d8ca72428486af60a12755823af0d20735 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Uzna=C5=84ski?= Date: Tue, 27 Sep 2022 11:53:43 +0200 Subject: [PATCH] [TASK] Replace switchable controller actions (#575) --- CHANGELOG.md | 1 + Configuration/FlexForms/Plugin.xml | 39 --------------------- Configuration/TCA/Overrides/tt_content.php | 23 +++++++----- Resources/Private/Language/de.locallang.xlf | 12 ++----- Resources/Private/Language/locallang.xlf | 10 ++---- Resources/Private/Templates/Tea/Index.html | 2 +- ext_localconf.php | 14 ++++++-- 7 files changed, 32 insertions(+), 69 deletions(-) delete mode 100644 Configuration/FlexForms/Plugin.xml diff --git a/CHANGELOG.md b/CHANGELOG.md index dcd9de4..72ce3dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ This project adheres to [Semantic Versioning](https://semver.org/). ### Added ### Changed +- Replace switchable controller actions with separate plugins (#575) ### Deprecated diff --git a/Configuration/FlexForms/Plugin.xml b/Configuration/FlexForms/Plugin.xml deleted file mode 100644 index a32f305..0000000 --- a/Configuration/FlexForms/Plugin.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - array - - - - - reload - - select - selectSingle - - - LLL:EXT:tea/Resources/Private/Language/locallang.xlf:plugin.tea.index - Tea->index - - - LLL:EXT:tea/Resources/Private/Language/locallang.xlf:plugin.tea.show - Tea->show - - - - - - - - - - diff --git a/Configuration/TCA/Overrides/tt_content.php b/Configuration/TCA/Overrides/tt_content.php index 21aeb20..0f13a4f 100644 --- a/Configuration/TCA/Overrides/tt_content.php +++ b/Configuration/TCA/Overrides/tt_content.php @@ -7,18 +7,23 @@ defined('TYPO3') || die(); // extension name, matching the PHP namespaces (but without the vendor) 'Tea', // arbitrary, but unique plugin name (not visible in the BE) - 'Tea', + 'TeaIndex', // plugin title, as visible in the drop-down in the BE - 'LLL:EXT:tea/Resources/Private/Language/locallang.xlf:plugin.tea', + 'LLL:EXT:tea/Resources/Private/Language/locallang.xlf:plugin.tea_index', // the icon visible in the drop-down in the BE 'EXT:tea/Resources/Public/Icons/Extension.svg' ); -// This removes the default controls from the plugin. -$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['tea_tea'] = 'recursive,select_key,pages'; -// These two commands add the flexform configuration for the plugin. -$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['tea_tea'] = 'pi_flexform'; -\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue( - 'tea_tea', - 'FILE:EXT:tea/Configuration/FlexForms/Plugin.xml' +\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin( + 'Tea', + 'TeaShow', + 'LLL:EXT:tea/Resources/Private/Language/locallang.xlf:plugin.tea_show', + 'EXT:tea/Resources/Public/Icons/Extension.svg' ); + +// This removes the default controls from the plugin. +$controlsToRemove = 'recursive,select_key,pages'; +$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist'] = [ + 'tea_teaindex' => $controlsToRemove, + 'tea_teashow' => $controlsToRemove, +]; diff --git a/Resources/Private/Language/de.locallang.xlf b/Resources/Private/Language/de.locallang.xlf index cbe0ace..0f4f79d 100644 --- a/Resources/Private/Language/de.locallang.xlf +++ b/Resources/Private/Language/de.locallang.xlf @@ -3,19 +3,11 @@
- - Tea - Tee - - - View - Ansicht - - + Tea list Teeliste - + Tea single view Tee-Einzelansicht diff --git a/Resources/Private/Language/locallang.xlf b/Resources/Private/Language/locallang.xlf index 19852ed..c91701a 100644 --- a/Resources/Private/Language/locallang.xlf +++ b/Resources/Private/Language/locallang.xlf @@ -3,16 +3,10 @@
- - Tea - - - View - - + Tea list - + Tea single view diff --git a/Resources/Private/Templates/Tea/Index.html b/Resources/Private/Templates/Tea/Index.html index 91dccc5..21c5435 100644 --- a/Resources/Private/Templates/Tea/Index.html +++ b/Resources/Private/Templates/Tea/Index.html @@ -25,7 +25,7 @@ {tea.uid} - + {tea.title} diff --git a/ext_localconf.php b/ext_localconf.php index ff7f2d9..5dad551 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -8,14 +8,24 @@ defined('TYPO3') or die('Access denied.'); // extension name, matching the PHP namespaces (but without the vendor) 'Tea', // arbitrary, but unique plugin name (not visible in the BE) - 'Tea', + 'TeaIndex', // all actions [ - \TTN\Tea\Controller\TeaController::class => 'index, show', + \TTN\Tea\Controller\TeaController::class => 'index', ], // non-cacheable actions [ \TTN\Tea\Controller\TeaController::class => '', ] ); + \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( + 'Tea', + 'TeaShow', + [ + \TTN\Tea\Controller\TeaController::class => 'show', + ], + [ + \TTN\Tea\Controller\TeaController::class => '', + ] + ); })();