diff --git a/Classes/Controller/AbstractBaseController.php b/Classes/Controller/AbstractBaseController.php index b9aa020d7e..6fcec6a566 100644 --- a/Classes/Controller/AbstractBaseController.php +++ b/Classes/Controller/AbstractBaseController.php @@ -90,6 +90,28 @@ public function setResetConfigurationBeforeInitialize(bool $resetConfigurationBe $this->resetConfigurationBeforeInitialize = $resetConfigurationBeforeInitialize; } + /** + * Initialize the controller context + * + * @return SolrControllerContext ControllerContext to be passed to the view + * @api + */ + protected function buildControllerContext(): SolrControllerContext + { + /** @var $controllerContext SolrControllerContext */ + $controllerContext = GeneralUtility::makeInstance(SolrControllerContext::class); +// $controllerContext->setRequest($this->request); +// $controllerContext->setResponse($this->response); +// if ($this->arguments !== null) { +// $controllerContext->setArguments($this->arguments); +// } +// $controllerContext->setUriBuilder($this->uriBuilder); + + $controllerContext->setTypoScriptConfiguration($this->typoScriptConfiguration); + + return $controllerContext; + } + /** * Initialize action */ diff --git a/Classes/Task/IndexQueueWorkerTaskAdditionalFieldProvider.php b/Classes/Task/IndexQueueWorkerTaskAdditionalFieldProvider.php index abb32594ef..7b8e9beb0e 100644 --- a/Classes/Task/IndexQueueWorkerTaskAdditionalFieldProvider.php +++ b/Classes/Task/IndexQueueWorkerTaskAdditionalFieldProvider.php @@ -35,14 +35,9 @@ */ class IndexQueueWorkerTaskAdditionalFieldProvider extends AbstractAdditionalFieldProvider { - /** - * SiteRepository - */ - protected SiteRepository $siteRepository; - - public function __construct() - { - $this->siteRepository = GeneralUtility::makeInstance(SiteRepository::class); + public function __construct( + protected readonly SiteRepository $siteRepository + ) { } /** diff --git a/Configuration/Services.yaml b/Configuration/Services.yaml index 481e80cae4..dd501fb395 100644 --- a/Configuration/Services.yaml +++ b/Configuration/Services.yaml @@ -56,7 +56,7 @@ services: event: TYPO3\CMS\Backend\View\Event\PageContentPreviewRenderingEvent # END: BE modules - viewhelper_backend: + viewHelpers_backend: namespace: ApacheSolrForTypo3\Solr\ViewHelpers\Backend\ resource: '../Classes/ViewHelpers/Backend/*' public: true @@ -204,6 +204,10 @@ services: - name: event.listener identifier: 'solr.index.FrontendHelper.PageIndexer.indexPageContentAfterCacheableContentIsGenerated' event: TYPO3\CMS\Frontend\Event\AfterCacheableContentIsGeneratedEvent + ApacheSolrForTypo3\Solr\Task\IndexQueueWorkerTaskAdditionalFieldProvider: + public: true + arguments: + $siteRepository: '@ApacheSolrForTypo3\Solr\Domain\Site\SiteRepository' ### EXT:solr content objects ApacheSolrForTypo3\Solr\ContentObject\Classification: diff --git a/ext_localconf.php b/ext_localconf.php index 30292da154..c8e6ce0faf 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -2,6 +2,9 @@ use ApacheSolrForTypo3\Solr\GarbageCollector; use ApacheSolrForTypo3\Solr\IndexQueue\RecordMonitor; +use ApacheSolrForTypo3\Solr\Controller\SearchController; +use ApacheSolrForTypo3\Solr\IndexQueue\FrontendHelper\Manager as FrontendHelperManager; +use TYPO3\CMS\Extbase\Utility\ExtensionUtility; defined('TYPO3') or die('Access denied.'); @@ -23,12 +26,12 @@ // registering Index Queue page indexer helpers $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['Indexer']['indexPageSubstitutePageDocument'][\ApacheSolrForTypo3\Solr\AdditionalFieldsIndexer::class] = \ApacheSolrForTypo3\Solr\AdditionalFieldsIndexer::class; - \ApacheSolrForTypo3\Solr\IndexQueue\FrontendHelper\Manager::registerFrontendHelper( + FrontendHelperManager::registerFrontendHelper( 'findUserGroups', \ApacheSolrForTypo3\Solr\IndexQueue\FrontendHelper\UserGroupDetector::class ); - \ApacheSolrForTypo3\Solr\IndexQueue\FrontendHelper\Manager::registerFrontendHelper( + FrontendHelperManager::registerFrontendHelper( 'indexPage', \ApacheSolrForTypo3\Solr\IndexQueue\FrontendHelper\PageIndexer::class ); @@ -210,37 +213,37 @@ // ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # - \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( + ExtensionUtility::configurePlugin( 'Solr', 'pi_results', [ - \ApacheSolrForTypo3\Solr\Controller\SearchController::class => 'results,form,detail', + SearchController::class => 'results,form,detail', ], [ - \ApacheSolrForTypo3\Solr\Controller\SearchController::class => 'results', + SearchController::class => 'results', ] ); - \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( + ExtensionUtility::configurePlugin( 'Solr', 'pi_search', [ - \ApacheSolrForTypo3\Solr\Controller\SearchController::class => 'form', + SearchController::class => 'form', ] ); - \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( + ExtensionUtility::configurePlugin( 'Solr', 'pi_frequentlySearched', [ - \ApacheSolrForTypo3\Solr\Controller\SearchController::class => 'frequentlySearched', + SearchController::class => 'frequentlySearched', ], [ - \ApacheSolrForTypo3\Solr\Controller\SearchController::class => 'frequentlySearched', + SearchController::class => 'frequentlySearched', ] ); - \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( + ExtensionUtility::configurePlugin( 'Solr', 'pi_suggest', [