From 4df4165df8cb8b9580384c4491600f82be05ccf9 Mon Sep 17 00:00:00 2001 From: "lina.wolf" Date: Mon, 8 May 2023 16:38:12 +0000 Subject: [PATCH] [FEATURE] Display Plugins in "New Content Element" Wizard resolves https://github.com/TYPO3-Documentation/tea/issues/825 --- Configuration/Icons.php | 11 ++ Configuration/TCA/Overrides/tt_content.php | 4 +- .../TsConfig/Page/newContentElement.tsconfig | 27 ++++ Configuration/page.tsconfig | 1 + Resources/Private/Language/de.locallang.xlf | 8 ++ Resources/Private/Language/locallang.xlf | 6 + Resources/Public/Icons/Plugin.svg | 119 ++++++++++++++++++ ext_localconf.php | 10 ++ 8 files changed, 184 insertions(+), 2 deletions(-) create mode 100644 Configuration/Icons.php create mode 100644 Configuration/TsConfig/Page/newContentElement.tsconfig create mode 100644 Configuration/page.tsconfig create mode 100644 Resources/Public/Icons/Plugin.svg diff --git a/Configuration/Icons.php b/Configuration/Icons.php new file mode 100644 index 0000000..b738501 --- /dev/null +++ b/Configuration/Icons.php @@ -0,0 +1,11 @@ + [ + // Icon provider class + 'provider' => \TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class, + // The source SVG for the SvgIconProvider + 'source' => 'EXT:tea/Resources/Public/Icons/Plugin.svg', + ], +]; diff --git a/Configuration/TCA/Overrides/tt_content.php b/Configuration/TCA/Overrides/tt_content.php index cd25ffb..699cc86 100644 --- a/Configuration/TCA/Overrides/tt_content.php +++ b/Configuration/TCA/Overrides/tt_content.php @@ -13,14 +13,14 @@ call_user_func( // plugin title, as visible in the drop-down in the BE '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' + 'tea_plugin' ); \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' + 'tea_plugin' ); // This removes the default controls from the plugin. diff --git a/Configuration/TsConfig/Page/newContentElement.tsconfig b/Configuration/TsConfig/Page/newContentElement.tsconfig new file mode 100644 index 0000000..b979327 --- /dev/null +++ b/Configuration/TsConfig/Page/newContentElement.tsconfig @@ -0,0 +1,27 @@ +mod.wizards.newContentElement.wizardItems { + // add the plugins to the "Create new content element" wizard + plugins { + elements { + tea_teaindex { + title = LLL:EXT:tea/Resources/Private/Language/locallang.xlf:plugin.tea_index + description = LLL:EXT:tea/Resources/Private/Language/locallang.xlf:plugin.tea_index.description + iconIdentifier = tea_plugin + tt_content_defValues { + CType = list + list_type = = tea_teaindex + } + } + tea_teashow { + title = LLL:EXT:tea/Resources/Private/Language/locallang.xlf:plugin.tea_show + description = LLL:EXT:tea/Resources/Private/Language/locallang.xlf:plugin.tea_teashow.description + iconIdentifier = tea_plugin + tt_content_defValues { + CType = list + list_type = = tea_teashow + } + } + } + + show := addToList(tea_teaindex, tea_teashow) + } +} diff --git a/Configuration/page.tsconfig b/Configuration/page.tsconfig new file mode 100644 index 0000000..1e91846 --- /dev/null +++ b/Configuration/page.tsconfig @@ -0,0 +1 @@ +@import 'EXT:tea/Configuration/TsConfig/Page/*.tsconfig' diff --git a/Resources/Private/Language/de.locallang.xlf b/Resources/Private/Language/de.locallang.xlf index 0f4f79d..41895af 100644 --- a/Resources/Private/Language/de.locallang.xlf +++ b/Resources/Private/Language/de.locallang.xlf @@ -7,10 +7,18 @@ Tea list Teeliste + + Displays a list of teas + Zeigt eine Liste von Tees an + Tea single view Tee-Einzelansicht + + Displays a single tea record + Zeigt einen einzelnen Tee Datensatz an + Our selection of assorted teas Unsere Auswahl an erlesenen Tees diff --git a/Resources/Private/Language/locallang.xlf b/Resources/Private/Language/locallang.xlf index c91701a..4a4d26d 100644 --- a/Resources/Private/Language/locallang.xlf +++ b/Resources/Private/Language/locallang.xlf @@ -6,9 +6,15 @@ Tea list + + Displays a list of teas + Tea single view + + Displays a single tea record + Our selection of assorted teas diff --git a/Resources/Public/Icons/Plugin.svg b/Resources/Public/Icons/Plugin.svg new file mode 100644 index 0000000..a234846 --- /dev/null +++ b/Resources/Public/Icons/Plugin.svg @@ -0,0 +1,119 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/ext_localconf.php b/ext_localconf.php index 74d7164..fa8d3d4 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -3,6 +3,9 @@ declare(strict_types=1); use TTN\Tea\Controller\TeaController; +use TYPO3\CMS\Core\Information\Typo3Version; +use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; +use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Utility\ExtensionUtility; defined('TYPO3') or die('Access denied.'); @@ -32,3 +35,10 @@ ExtensionUtility::configurePlugin( TeaController::class => '', ] ); +$versionInformation = GeneralUtility::makeInstance(Typo3Version::class); +// Only include page.tsconfig if TYPO3 version is below 12 so that it is not imported twice. +if ($versionInformation->getMajorVersion() < 12) { + ExtensionManagementUtility::addPageTSConfig( + '@import "EXT:tea/Configuration/page.tsconfig"' + ); +}