From eadde0cd250d955debb37b3b14d4923caf92a811 Mon Sep 17 00:00:00 2001 From: Mathias Brodala Date: Wed, 22 Jun 2022 16:57:31 +0200 Subject: [PATCH] [TASK] Use controller classes for plugin/module setup See https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/11.0/Breaking-92609-UseControllerClassesWhenRegisteringPluginsmodules.html --- ext_localconf.php | 84 +++++++++++++++++++++++++++++++++++++---------- ext_tables.php | 34 +++++++++++++------ 2 files changed, 90 insertions(+), 28 deletions(-) diff --git a/ext_localconf.php b/ext_localconf.php index 2efe2301..7af7319f 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -3,27 +3,75 @@ die('Access denied.'); } -\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( - 'PAGEmachine.Searchable', - 'Searchbar', - ['Search' => 'searchbar'], - ['Search' => 'searchbar'] -); +if (version_compare(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getCurrentTypo3Version(), '11', '>=')) { + \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( + 'Searchable', + 'Searchbar', + [ + \PAGEmachine\Searchable\Controller\SearchController::class => 'searchbar', + ], + [ + \PAGEmachine\Searchable\Controller\SearchController::class => 'searchbar', + ] + ); + + \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( + 'Searchable', + 'LiveSearchbar', + [ + \PAGEmachine\Searchable\Controller\SearchController::class => 'liveSearchbar', + ], + [ + \PAGEmachine\Searchable\Controller\SearchController::class => 'liveSearchbar', + ] + ); + + + \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( + 'Searchable', + 'Results', + [ + \PAGEmachine\Searchable\Controller\SearchController::class => 'results', + ], + [ + \PAGEmachine\Searchable\Controller\SearchController::class => 'results', + ] + ); +} else { + \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( + 'PAGEmachine.Searchable', + 'Searchbar', + [ + 'Search' => 'searchbar', + ], + [ + 'Search' => 'searchbar', + ] + ); -\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( - 'PAGEmachine.Searchable', - 'LiveSearchbar', - ['Search' => 'liveSearchbar'], - ['Search' => 'liveSearchbar'] -); + \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( + 'PAGEmachine.Searchable', + 'LiveSearchbar', + [ + 'Search' => 'liveSearchbar', + ], + [ + 'Search' => 'liveSearchbar', + ] + ); + \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( + 'PAGEmachine.Searchable', + 'Results', + [ + 'Search' => 'results', + ], + [ + 'Search' => 'results', + ] + ); +} -\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( - 'PAGEmachine.Searchable', - 'Results', - ['Search' => 'results'], - ['Search' => 'results'] -); // Add custom logging if (empty($GLOBALS['TYPO3_CONF_VARS']['LOG']['PAGEmachine']['Searchable']['writerConfiguration'])) { diff --git a/ext_tables.php b/ext_tables.php index 3816411e..ef21fbdb 100644 --- a/ext_tables.php +++ b/ext_tables.php @@ -3,20 +3,34 @@ die('Access denied.'); } -// Backend module -if (TYPO3_MODE === 'BE') { +if (version_compare(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getCurrentTypo3Version(), '11', '>=')) { + \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule( + 'Searchable', + 'web', + 'searchable', + '', + [ + \PAGEmachine\Searchable\Controller\BackendController::class => 'start, search, request, resetIndices, indexFull, indexPartial', + ], + [ + 'access' => 'user,group', + 'icon' => 'EXT:searchable/ext_icon.svg', + 'labels' => 'LLL:EXT:searchable/Resources/Private/Language/locallang_mod.xlf', + ] + ); +} else { \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule( 'PAGEmachine.Searchable', 'web', 'searchable', '', - array( - 'Backend' => 'start, search, request, resetIndices, indexFull, indexPartial' - ), - array( - 'access' => 'user,group', - 'icon' => 'EXT:searchable/ext_icon.svg', - 'labels' => 'LLL:EXT:searchable/Resources/Private/Language/locallang_mod.xlf' - ) + [ + 'Backend' => 'start, search, request, resetIndices, indexFull, indexPartial', + ], + [ + 'access' => 'user,group', + 'icon' => 'EXT:searchable/ext_icon.svg', + 'labels' => 'LLL:EXT:searchable/Resources/Private/Language/locallang_mod.xlf', + ] ); }