diff --git a/Classes/Backend/SettingsPreviewOnPlugins.php b/Classes/Backend/SettingsPreviewOnPlugins.php index bc795f2eaf..472db4f58f 100644 --- a/Classes/Backend/SettingsPreviewOnPlugins.php +++ b/Classes/Backend/SettingsPreviewOnPlugins.php @@ -45,7 +45,7 @@ public function __invoke(PageContentPreviewRenderingEvent $event): void $this->pluginsTtContentRecord = $event->getRecord(); if ( $event->getTable() !== 'tt_content' - || !str_starts_with($this->pluginsTtContentRecord['list_type'], 'solr_pi_') + || !str_starts_with($this->pluginsTtContentRecord['CType'], 'solr_pi_') ) { return; } @@ -152,14 +152,17 @@ protected function getPluginLabel(): string $label = BackendUtility::getLabelFromItemListMerged( $this->pluginsTtContentRecord['pid'], 'tt_content', - 'list_type', - $this->pluginsTtContentRecord['list_type'], + 'CType', + $this->pluginsTtContentRecord['CType'], $this->pluginsTtContentRecord ); if (!empty($label)) { $label = $this->getLanguageService()->sL($label); } else { - $label = sprintf($this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.noMatchingValue'), $this->pluginsTtContentRecord['list_type']); + $label = sprintf( + $this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.noMatchingValue'), + $this->pluginsTtContentRecord['CType'] + ); } return $label; diff --git a/Classes/Updates/SolrSearchCTypeMigration.php b/Classes/Updates/SolrSearchCTypeMigration.php new file mode 100644 index 0000000000..0684989263 --- /dev/null +++ b/Classes/Updates/SolrSearchCTypeMigration.php @@ -0,0 +1,48 @@ + 'solr_pi_results', + 'solr_pi_search' => 'solr_pi_search', + 'solr_pi_results_search' => 'solr_pi_results_search', + ]; + } + + public function getTitle(): string + { + return 'Migrate "Apache Solr Search" plugins to content elements.'; + } + + public function getDescription(): string + { + return 'The "Apache Solr Search" plugins are now registered as content elements. Update migrates existing records and backend user permissions.'; + } +} diff --git a/Configuration/Services.yaml b/Configuration/Services.yaml index 9a9b8f2824..0766814514 100644 --- a/Configuration/Services.yaml +++ b/Configuration/Services.yaml @@ -334,3 +334,10 @@ services: ApacheSolrForTypo3\Solr\Report\: resource: '../Classes/Report/*' autoconfigure: true + + # Upgrade wizards + ApacheSolrForTypo3\Solr\Updates\: + resource: '../Classes/Updates/*' + autoconfigure: true + autowire: true + shared: false diff --git a/Configuration/TCA/Overrides/tt_content.php b/Configuration/TCA/Overrides/tt_content.php index 51a9b84685..1a61872011 100644 --- a/Configuration/TCA/Overrides/tt_content.php +++ b/Configuration/TCA/Overrides/tt_content.php @@ -5,44 +5,43 @@ defined('TYPO3') or die('Access denied.'); +// Add tt_content search group +$GLOBALS['TCA']['tt_content']['columns']['CType']['config']['itemGroups']['search'] = 'LLL:EXT:solr/Resources/Private/Language/locallang.xlf:plugin_results'; + // Register the plugins -$pluginSignature = 'solr_pi_search'; -ExtensionUtility::registerPlugin( +$pluginSearchSignature = ExtensionUtility::registerPlugin( 'solr', 'pi_search', - 'LLL:EXT:solr/Resources/Private/Language/locallang.xlf:tt_content.list_type_pi_search' + 'LLL:EXT:solr/Resources/Private/Language/locallang.xlf:tt_content.CType_pi_search', + 'extensions-solr-plugin-contentelement', + 'search' ); -$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist'][$pluginSignature] - = 'layout,select_key,pages,recursive'; -$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] - = 'pi_flexform'; +$GLOBALS['TCA']['tt_content']['types'][$pluginSearchSignature]['showitem'] = 'pi_flexform'; ExtensionManagementUtility::addPiFlexFormValue( - $pluginSignature, - 'FILE:EXT:solr/Configuration/FlexForms/Form.xml' + '*', + 'FILE:EXT:solr/Configuration/FlexForms/Form.xml', + $pluginSearchSignature ); -$pluginSignature = 'solr_pi_frequentlysearched'; -ExtensionUtility::registerPlugin( +$pluginFrequentlySearchedSignature = ExtensionUtility::registerPlugin( 'solr', 'pi_frequentlySearched', - 'LLL:EXT:solr/Resources/Private/Language/locallang.xlf:tt_content.list_type_pi_frequentsearches' + 'LLL:EXT:solr/Resources/Private/Language/locallang.xlf:tt_content.CType_pi_frequentsearches', + 'extensions-solr-plugin-contentelement', + 'search' ); -$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist'][$pluginSignature] - = 'layout,select_key,pages,recursive'; +$GLOBALS['TCA']['tt_content']['types'][$pluginFrequentlySearchedSignature]['showitem'] = ''; -$pluginSignature = 'solr_pi_results'; -ExtensionUtility::registerPlugin( +$pluginResultsSignature = ExtensionUtility::registerPlugin( 'solr', 'pi_results', - 'LLL:EXT:solr/Resources/Private/Language/locallang.xlf:tt_content.list_type_pi_results' + 'LLL:EXT:solr/Resources/Private/Language/locallang.xlf:tt_content.CType_pi_results', + 'extensions-solr-plugin-contentelement', + 'search' ); - -$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist'][$pluginSignature] - = 'layout,select_key,pages,recursive'; -$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] - = 'pi_flexform'; - +$GLOBALS['TCA']['tt_content']['types'][$pluginResultsSignature]['showitem'] = 'pi_flexform'; ExtensionManagementUtility::addPiFlexFormValue( - $pluginSignature, - 'FILE:EXT:solr/Configuration/FlexForms/Results.xml' + '*', + 'FILE:EXT:solr/Configuration/FlexForms/Results.xml', + $pluginResultsSignature ); diff --git a/Configuration/page.tsconfig b/Configuration/page.tsconfig index f78e0c62fe..96b1a3e315 100644 --- a/Configuration/page.tsconfig +++ b/Configuration/page.tsconfig @@ -1,13 +1,4 @@ -mod.wizards.newContentElement.wizardItems.plugins { - elements { - tx_solr_results { - iconIdentifier = extensions-solr-plugin-contentelement - title = LLL:EXT:solr/Resources/Private/Language/locallang.xlf:plugin_results - description = LLL:EXT:solr/Resources/Private/Language/locallang.xlf:plugin_results_description - tt_content_defValues { - CType = list - list_type = solr_pi_results - } - } - } +mod.wizards.newContentElement.wizardItems { + # CATEGORIES + search.header = LLL:EXT:solr/Resources/Private/Language/locallang.xlf:plugin_results } diff --git a/Documentation/Images/Backend/plugin_instances.png b/Documentation/Images/Backend/plugin_instances.png index 8184bc52c8..630058d3c1 100644 Binary files a/Documentation/Images/Backend/plugin_instances.png and b/Documentation/Images/Backend/plugin_instances.png differ diff --git a/Documentation/Images/GettingStarted/install-script.png b/Documentation/Images/GettingStarted/install-script.png deleted file mode 100644 index 6a9e1ad58d..0000000000 Binary files a/Documentation/Images/GettingStarted/install-script.png and /dev/null differ diff --git a/Resources/Private/Language/de.locallang.xlf b/Resources/Private/Language/de.locallang.xlf index d83399c38d..77b54fb3c8 100644 --- a/Resources/Private/Language/de.locallang.xlf +++ b/Resources/Private/Language/de.locallang.xlf @@ -132,13 +132,13 @@ Letzte - + Search: Frequent Searches Suche: Häufige Suchen - + Search: Form, Result, Additional Components Suche: Formular, Ergebnisse, weitere Komponenten - + Search: Form only Suche: Nur Suchformular diff --git a/Resources/Private/Language/dk.locallang.xlf b/Resources/Private/Language/dk.locallang.xlf index 54d401e10c..9756ec8e99 100644 --- a/Resources/Private/Language/dk.locallang.xlf +++ b/Resources/Private/Language/dk.locallang.xlf @@ -148,18 +148,18 @@ - + Search: Frequent Searches - + Search: Form, Result, Additional Components Søg: Søgeformular, Resultater, Yderligere komponenter - + Search: Form only - \ No newline at end of file + diff --git a/Resources/Private/Language/locallang.xlf b/Resources/Private/Language/locallang.xlf index a668a93742..665b20b9da 100644 --- a/Resources/Private/Language/locallang.xlf +++ b/Resources/Private/Language/locallang.xlf @@ -339,13 +339,13 @@ - + Search: Frequent Searches - + Search: Form, Result, Additional Components - + Search: Form only diff --git a/Tests/Integration/Backend/SettingsPreviewOnPluginsTest.php b/Tests/Integration/Backend/SettingsPreviewOnPluginsTest.php index ceb6ed58c5..f8f5842417 100644 --- a/Tests/Integration/Backend/SettingsPreviewOnPluginsTest.php +++ b/Tests/Integration/Backend/SettingsPreviewOnPluginsTest.php @@ -74,7 +74,7 @@ public function printsPreviewOnExtSolrPluginsCorrectly(): void [ 'pid' => 11, 'pi_flexform' => 'provided via mock return value $this->flexFormArray', - 'list_type' => 'solr_pi_results', + 'CType' => 'solr_pi_results', 'hidden' => 0, ] ); diff --git a/Tests/Integration/Controller/Fixtures/default_search_results_plugin.csv b/Tests/Integration/Controller/Fixtures/default_search_results_plugin.csv index 956a00fa8f..11731bb02b 100644 --- a/Tests/Integration/Controller/Fixtures/default_search_results_plugin.csv +++ b/Tests/Integration/Controller/Fixtures/default_search_results_plugin.csv @@ -2,5 +2,5 @@ ,"uid","pid","is_siteroot","doktype","slug","title","subtitle" ,2022,1,0,1,"/search","Search","Apache Solr for TYPO3 search page" "tt_content", -,"uid","pid","colPos","frame_class","CType","list_type","sectionIndex" -,2022,2022,0,"default","list","solr_pi_results",1 +,"uid","pid","colPos","frame_class","CType","sectionIndex" +,2022,2022,0,"default","solr_pi_results",1 diff --git a/Tests/Integration/Controller/SearchControllerTest.php b/Tests/Integration/Controller/SearchControllerTest.php index 2c3020fae2..d0c708aeb4 100644 --- a/Tests/Integration/Controller/SearchControllerTest.php +++ b/Tests/Integration/Controller/SearchControllerTest.php @@ -1233,7 +1233,7 @@ public function formActionIsRenderingTheForm(): void $connection = $this->getConnectionPool()->getConnectionForTable('tt_content'); $connection->update( 'tt_content', - ['list_type' => 'solr_pi_search'], + ['CType' => 'solr_pi_search'], ['uid' => 2022] ); @@ -1259,7 +1259,7 @@ public function searchingAndRenderingFrequentSearchesIsShowingTheTermAsFrequentS $this->getConnectionPool()->getConnectionForTable('tt_content') ->update( 'tt_content', - ['list_type' => 'solr_pi_frequentlysearched'], + ['CType' => 'solr_pi_frequentlysearched'], ['uid' => 2022] ); diff --git a/Tests/Unit/Backend/SettingsPreviewOnPluginsTest.php b/Tests/Unit/Backend/SettingsPreviewOnPluginsTest.php index 5f58b635ec..e950a568c7 100644 --- a/Tests/Unit/Backend/SettingsPreviewOnPluginsTest.php +++ b/Tests/Unit/Backend/SettingsPreviewOnPluginsTest.php @@ -50,7 +50,7 @@ public function doesNotPrintPreviewOnNonExtSolrPlugins(): void $this->getFakePageContentPreviewRenderingEvent( 'tt_content', [ - 'list_type' => 'some_other_CE', + 'CType' => 'some_other_CE', ] ) ); diff --git a/composer.json b/composer.json index 2c2498dcc8..cd0f39f69d 100644 --- a/composer.json +++ b/composer.json @@ -29,10 +29,11 @@ "ext-simplexml": "*", "solarium/solarium": "6.3.5", "typo3/cms-backend": "*", - "typo3/cms-core": "^v13.1", + "typo3/cms-core": "^v13.4", "typo3/cms-extbase": "*", "typo3/cms-fluid": "*", "typo3/cms-frontend": "*", + "typo3/cms-install": "*", "typo3/cms-reports": "*", "typo3/cms-scheduler": "*", "typo3/cms-tstemplate": "*" diff --git a/ext_localconf.php b/ext_localconf.php index aa1cedc83c..abc0d3c65e 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -179,7 +179,8 @@ ], [ SearchController::class => 'results', - ] + ], + ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT ); ExtensionUtility::configurePlugin( @@ -187,7 +188,11 @@ 'pi_search', [ SearchController::class => 'form', - ] + ], + [ + + ], + ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT ); ExtensionUtility::configurePlugin( @@ -198,7 +203,8 @@ ], [ SearchController::class => 'frequentlySearched', - ] + ], + ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT ); ExtensionUtility::configurePlugin( @@ -209,7 +215,8 @@ ], [ SuggestController::class => 'suggest', - ] + ], + ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT ); // register the Fluid namespace 'solr' globally