diff --git a/Classes/Controller/SearchController.php b/Classes/Controller/SearchController.php index 42532c73..3756924f 100644 --- a/Classes/Controller/SearchController.php +++ b/Classes/Controller/SearchController.php @@ -28,7 +28,12 @@ * * This copyright notice MUST APPEAR in all copies of the script! * ************************************************************* */ - +use Psr\Log\LoggerInterface; +use TYPO3\CMS\Extbase\Mvc\Exception\NoSuchArgumentException; +use TYPO3\CMS\Extbase\Mvc\Exception\StopActionException; +use Psr\Http\Message\ResponseInterface; +use TYPO3\CMS\Extbase\Http\ForwardResponse; +use TYPO3\CMS\Core\Utility\HttpUtility; use Subugoe\Find\Service\ServiceProviderInterface; use Subugoe\Find\Utility\ArrayUtility; use Subugoe\Find\Utility\FrontendUtility; @@ -43,7 +48,7 @@ class SearchController extends ActionController protected ?object $searchProvider = null; - private \Psr\Log\LoggerInterface $logger; + private LoggerInterface $logger; public function __construct(LogManagerInterface $logManager) { @@ -51,10 +56,10 @@ public function __construct(LogManagerInterface $logManager) } /** - * @throws \TYPO3\CMS\Extbase\Mvc\Exception\NoSuchArgumentException - * @throws \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException + * @throws NoSuchArgumentException + * @throws StopActionException */ - public function detailAction(string $id) + public function detailAction(string $id): ResponseInterface { $arguments = $this->searchProvider->getRequestArguments(); $detail = $this->searchProvider->getDocumentById($id); @@ -76,12 +81,13 @@ public function detailAction(string $id) 'arguments' => $arguments, 'config' => $this->searchProvider->getConfiguration() ]); + return $this->htmlResponse(); } /** * Citation Action. */ - public function citationAction() { + public function citationAction(): ResponseInterface { $arguments = $this->requestArguments; $detail = $this->searchProvider->getDocumentById($arguments["id"]); @@ -94,23 +100,24 @@ public function citationAction() { 'config' => $this->searchProvider->getConfiguration(), 'type' => $arguments['type'] ]); + return $this->htmlResponse(); } /** * Index Action. */ - public function indexAction() + public function indexAction(): ResponseInterface { if (array_key_exists('id', $this->requestArguments)) { - $this->forward('detail'); + return new ForwardResponse('detail'); } elseif (array_key_exists('rsn', $this->requestArguments)) { - $this->forward('redirect'); + return new ForwardResponse('redirect'); } elseif (array_key_exists('bc', $this->requestArguments)) { - $this->forward('redirect'); + return new ForwardResponse('redirect'); } elseif (array_key_exists('ppn', $this->requestArguments)) { - $this->forward('redirect'); + return new ForwardResponse('redirect'); } elseif (array_key_exists('oclc', $this->requestArguments)) { - $this->forward('redirect'); + return new ForwardResponse('redirect'); } else { $this->searchProvider->setCounter(); FrontendUtility::addQueryInformationAsJavaScript( @@ -134,10 +141,11 @@ public function indexAction() // if there are no search parameters provided, redirect to the URL given in setting 'nosearchRedirect' if ($defaultQuery['noSearch']) { if(strlen($this->settings['nosearchRedirect']) > 0) { - \TYPO3\CMS\Core\Utility\HttpUtility::redirect($this->settings['nosearchRedirect']); + HttpUtility::redirect($this->settings['nosearchRedirect']); } } } + return $this->htmlResponse(); } /** @@ -186,7 +194,7 @@ public function redirectAction() { } $uri = $this->uriBuilder->reset()->setTargetPageUid(intval($GLOBALS['TSFE']->id))->setCreateAbsoluteUri(true)->setArguments($arguments)->build(); - \TYPO3\CMS\Core\Utility\HttpUtility::redirect($uri); + HttpUtility::redirect($uri); die(); } @@ -211,18 +219,20 @@ protected function initializeAction() /** * Suggest/Autocomplete action. */ - public function suggestAction() + public function suggestAction(): ResponseInterface { $results = $this->searchProvider->suggestQuery($this->searchProvider->getRequestArguments()); $this->view->assign('suggestions', $results); + return $this->htmlResponse(); } /** * Query indexed terms for given fields. */ - public function termAction(){ + public function termAction(): ResponseInterface{ $results = $this->searchProvider->getTerms($this->searchProvider->getRequestArguments()); $this->view->assign('terms', $results); + return $this->htmlResponse(); } /** diff --git a/Classes/Service/SolrServiceProvider.php b/Classes/Service/SolrServiceProvider.php index 5d312b1a..75c52a17 100644 --- a/Classes/Service/SolrServiceProvider.php +++ b/Classes/Service/SolrServiceProvider.php @@ -1177,7 +1177,7 @@ protected function getTheRecordSpecified($id, $assignments) $assignments['document'] = $resultSet[0]; } else { $localisationKey = 'LLL:' . $this->settings['languageRootPath'] . 'locallang:exception.deatilNoresult'; - $message = sprintf(\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate($localisationKey, null), $id); + $message = sprintf(LocalizationUtility::translate($localisationKey, null), $id); if (!$message) { $message = sprintf('»detail« action query for id »%s« returned no results.', $id); } @@ -1445,12 +1445,12 @@ protected function setSortOrder(array $arguments): void } /** - * Sets up $query’s grouping parameters from URL arguments or the TypoScript default. - * - * @param \Solarium\QueryType\Select\Query\Query $query - * @param array $arguments request arguments - */ - private function addGrouping ($arguments) { + * Sets up $query’s grouping parameters from URL arguments or the TypoScript default. + * + * @param Query $query + * @param array $arguments request arguments + */ + private function addGrouping ($arguments) { $limit = -1; $field = null; diff --git a/Classes/ViewHelpers/Find/HighlightFieldViewHelper.php b/Classes/ViewHelpers/Find/HighlightFieldViewHelper.php index 99ae8bb2..83ac15d1 100644 --- a/Classes/ViewHelpers/Find/HighlightFieldViewHelper.php +++ b/Classes/ViewHelpers/Find/HighlightFieldViewHelper.php @@ -26,6 +26,8 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. ******************************************************************************/ +use Solarium\QueryType\Select\Result\Result; +use Solarium\QueryType\Select\Result\Document; use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface; use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper; @@ -59,8 +61,8 @@ class HighlightFieldViewHelper extends AbstractViewHelper public function initializeArguments() { parent::initializeArguments(); - $this->registerArgument('results', \Solarium\QueryType\Select\Result\Result::class, 'Query results', true); - $this->registerArgument('document', \Solarium\QueryType\Select\Result\Document::class, 'Result document to work on', + $this->registerArgument('results', Result::class, 'Query results', true); + $this->registerArgument('document', Document::class, 'Result document to work on', true); $this->registerArgument('field', 'string', 'name of field in document to highlight', true); $this->registerArgument('alternateField', 'string', diff --git a/Classes/ViewHelpers/Format/SolrEscapeViewHelper.php b/Classes/ViewHelpers/Format/SolrEscapeViewHelper.php index 086ed510..1f578bd6 100644 --- a/Classes/ViewHelpers/Format/SolrEscapeViewHelper.php +++ b/Classes/ViewHelpers/Format/SolrEscapeViewHelper.php @@ -26,6 +26,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. ******************************************************************************/ +use Solarium\Core\Query\Helper; use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface; use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper; @@ -59,7 +60,7 @@ public static function renderStatic( $string = $renderChildrenClosure(); } - $solariumHelper = new \Solarium\Core\Query\Helper(); + $solariumHelper = new Helper(); return $arguments['phrase'] ? $solariumHelper->escapePhrase($string) : $solariumHelper->escapeTerm($string); } diff --git a/Classes/ViewHelpers/LinkedData/ContainerViewHelper.php b/Classes/ViewHelpers/LinkedData/ContainerViewHelper.php index 247c16aa..0d218699 100644 --- a/Classes/ViewHelpers/LinkedData/ContainerViewHelper.php +++ b/Classes/ViewHelpers/LinkedData/ContainerViewHelper.php @@ -26,7 +26,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. ******************************************************************************/ - +use Subugoe\Find\ViewHelpers\LinkedData\Renderer\AbstractRenderer; use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface; use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper; @@ -64,7 +64,7 @@ public static function renderStatic( $items = $renderingContext->getVariableProvider()->get($arguments['name']); $renderingContext->getVariableProvider()->remove($arguments['name']); - $LDRenderer = Renderer\AbstractRenderer::instantiateSubclassForType($arguments['format']); + $LDRenderer = AbstractRenderer::instantiateSubclassForType($arguments['format']); $LDRenderer->setPrefixes($arguments['prefixes']); return $LDRenderer->renderItems($items); diff --git a/Classes/ViewHelpers/Solr/CountFromSolrViewHelper.php b/Classes/ViewHelpers/Solr/CountFromSolrViewHelper.php index 255dcce9..0c2678d8 100644 --- a/Classes/ViewHelpers/Solr/CountFromSolrViewHelper.php +++ b/Classes/ViewHelpers/Solr/CountFromSolrViewHelper.php @@ -22,7 +22,8 @@ * * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ - +use TYPO3\CMS\Core\Utility\GeneralUtility; +use Solarium\QueryType\Select\Query\Query; use Solarium\Client; use Solarium\QueryType\Select\Result\Result; use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper; @@ -72,7 +73,7 @@ public function initializeArguments() public function render() { - $findParameter = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('tx_find_find'); + $findParameter = GeneralUtility::_GP('tx_find_find'); $activeFacets = $this->arguments['activeFacets']; $queryConcat = $this->arguments['queryConcat']; @@ -114,7 +115,7 @@ public function render() /** * Check configuration for shards and when found create Distributed Search. * - * @param \Solarium\QueryType\Select\Query\Query $query + * @param Query $query */ private function createQueryComponents(&$query) { @@ -130,7 +131,7 @@ private function createQueryComponents(&$query) /** * Adds filter queries configured in TypoScript to $query. * - * @param \Solarium\QueryType\Select\Query\Query $query + * @param Query $query */ private function addTypoScriptFilters($query) { @@ -148,7 +149,7 @@ private function addTypoScriptFilters($query) * @param string $id the document id * @param string $idfield the document id field * - * @return \Solarium\QueryType\Select\Query\Query + * @return Query */ private function createQuery($query) { diff --git a/Configuration/Icons.php b/Configuration/Icons.php new file mode 100644 index 00000000..1825571a --- /dev/null +++ b/Configuration/Icons.php @@ -0,0 +1,10 @@ + [ + 'provider' => FontawesomeIconProvider::class, + 'name' => 'search' + ], +]; diff --git a/Configuration/TCA/Overrides/sys_template.php b/Configuration/TCA/Overrides/sys_template.php index dac08bd6..dc491b42 100644 --- a/Configuration/TCA/Overrides/sys_template.php +++ b/Configuration/TCA/Overrides/sys_template.php @@ -1,8 +1,12 @@ '3.1.1', 'state' => 'stable', 'category' => 'frontend', - 'clearCacheOnLoad' => true, 'author' => 'Sven-S. Porst, Ingo Pfennigstorf', 'author_email' => 'pfennigstorf@sub.uni-goettingen.de', 'author_company' => 'SUB Göttingen', diff --git a/ext_localconf.php b/ext_localconf.php index 1f465bbc..b8cd6c70 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -1,5 +1,5 @@ 'index, detail, suggest, term, citation', ] ); - - if (TYPO3_MODE === 'BE') { - /* - * Register icons - */ - /** @var \TYPO3\CMS\Core\Imaging\IconRegistry $iconRegistry */ - $iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class); - $iconRegistry->registerIcon( - 'ext-find-ce-wizard', - \TYPO3\CMS\Core\Imaging\IconProvider\FontawesomeIconProvider::class, - ['name' => 'search'] - ); - } - + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig(''); }; $autoexec();