diff --git a/Classes/Controller/TermController.php b/Classes/Controller/TermController.php
index b7f5526..350c4c5 100755
--- a/Classes/Controller/TermController.php
+++ b/Classes/Controller/TermController.php
@@ -52,7 +52,15 @@ public function __construct(TermRepository $termRepository)
public function listAction(string $currentCharacter = null): ResponseInterface
{
$listMode = $this->settings['listmode'] ?? 'normal';
- $terms = $this->termRepository->findAll();
+
+ $searchTerm = $this->request->hasArgument('searchTerm')
+ ? trim((string)$this->request->getArgument('searchTerm'))
+ : null
+ ;
+ $terms = empty($searchTerm)
+ ? $terms = $this->termRepository->findAll()
+ : $this->termRepository->findByTerm($searchTerm)
+ ;
switch ($listMode) {
case 'character':
@@ -96,6 +104,7 @@ public function listAction(string $currentCharacter = null): ResponseInterface
$this->view->assignMultiple([
'listmode' => $listMode,
'terms' => $terms,
+ 'searchTerm' => $searchTerm,
]);
return $this->htmlResponse();
diff --git a/Classes/Domain/Repository/TermRepository.php b/Classes/Domain/Repository/TermRepository.php
index 52fb9b1..8e4994e 100644
--- a/Classes/Domain/Repository/TermRepository.php
+++ b/Classes/Domain/Repository/TermRepository.php
@@ -15,6 +15,8 @@
***/
use Featdd\DpnGlossary\Domain\Model\Term;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser;
use TYPO3\CMS\Extbase\Persistence\QueryInterface;
use TYPO3\CMS\Extbase\Persistence\QueryResultInterface;
@@ -23,6 +25,27 @@
*/
class TermRepository extends AbstractTermRepository
{
+ public function findByTerm(
+ string $term
+ ): QueryResultInterface {
+ $query = $this->createQuery();
+
+ $queryParser = GeneralUtility::makeInstance(Typo3DbQueryParser::class);
+ $queryBuilder = $queryParser->convertQueryToDoctrineQueryBuilder($query);
+
+ $searchTerm = $queryBuilder->getConnection()->escapeLikeWildcards($term) . '%';
+
+ $query->matching($query->logicalOr(
+ $query->like('name', $searchTerm),
+ $query->like('synonyms.name', $searchTerm),
+ $query->like('descriptions.meaning', $searchTerm),
+ ));
+ $queryBuilder = $queryParser->convertQueryToDoctrineQueryBuilder($query);
+
+ $result = $query->execute();
+ return $result;
+ }
+
/**
* finds the newest terms
*
diff --git a/Configuration/TypoScript/setup.typoscript b/Configuration/TypoScript/setup.typoscript
index a9c8230..a2abe46 100755
--- a/Configuration/TypoScript/setup.typoscript
+++ b/Configuration/TypoScript/setup.typoscript
@@ -71,6 +71,10 @@ plugin.tx_dpnglossary {
groupedListCharacters < .pagination.characters
+ list {
+ enableSearchForm = 0
+ }
+
termWraps = CASE
termWraps {
key.field = term_type
diff --git a/Resources/Private/Language/de.locallang.xlf b/Resources/Private/Language/de.locallang.xlf
index 7c33abd..548682a 100755
--- a/Resources/Private/Language/de.locallang.xlf
+++ b/Resources/Private/Language/de.locallang.xlf
@@ -186,6 +186,12 @@
Inhalt parsen
+
+
+
+
+ Absenden
+