Skip to content

Commit

Permalink
[FEATURE] Improve BeforeSearchResultIsShownEvent (#3915)
Browse files Browse the repository at this point in the history
This change allows the developers to provide additional variables to the view of EXT:solr FE plugins.

Relates: #3705
  • Loading branch information
georgringer authored Dec 13, 2023
1 parent eb7d2e6 commit 966a6ab
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions Classes/Controller/SearchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ public function resultsAction(): ResponseInterface
'arguments' => $afterSearchEvent->getArguments(),
'pagination' => $afterSearchEvent->getPagination(),
'currentPage' => $afterSearchEvent->getCurrentPage(),
'additionalVariables' => $afterSearchEvent->getAdditionalVariables(),
];

$this->view->assignMultiple($values);
Expand Down
11 changes: 11 additions & 0 deletions Classes/Event/Search/BeforeSearchResultIsShownEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ final class BeforeSearchResultIsShownEvent
private array $arguments;
protected PaginationInterface $pagination;
private int $currentPage;
protected array $additionalVariables = [];

public function __construct(
SearchResultSet $resultSet,
Expand Down Expand Up @@ -84,4 +85,14 @@ public function setPagination(PaginationInterface $pagination): void
{
$this->pagination = $pagination;
}

public function getAdditionalVariables(): array
{
return $this->additionalVariables;
}

public function setAdditionalVariables(array $additionalVariables): void
{
$this->additionalVariables = $additionalVariables;
}
}

0 comments on commit 966a6ab

Please sign in to comment.