Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions Classes/Controller/SearchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use TYPO3\CMS\Extbase\Mvc\Web\Response;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Fluid\View\TemplateView;
use TYPO3\CMS\Frontend\ContentObject\ContentDataProcessor;

/**
* Class SearchController
Expand All @@ -36,6 +37,19 @@ class SearchController extends AbstractBaseController
*/
protected $view;

/**
* @var ContentDataProcessor
*/
protected $contentDataProcessor;

/**
* @param ContentDataProcessor $contentDataProcessor
*/
public function injectContentDataProcessor(ContentDataProcessor $contentDataProcessor)
{
$this->contentDataProcessor = $contentDataProcessor;
}

/**
* Provide search query in extbase arguments.
*/
Expand Down Expand Up @@ -113,6 +127,11 @@ public function resultsAction()
];

$values = $this->emitActionSignal(__CLASS__, __FUNCTION__, [$values]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this signal unusable for the things you want?
If there is not all what you want, pack this in array.
Would propose to extend all the signals and pack the stuff in the docs and examples.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Main difference is that Data Processing is configured via typoscript, allowing to plug different configs in places.
Instead of Signals which are global.

Copy link
Collaborator

@dkd-kaehm dkd-kaehm Oct 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, i mean that we could plug this stuff via this signal[s], via something like "Facade/Gateway" or some other design pattern.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ContentDataProcessor only needs the ContentObjectRenderer which we can get pretty much anywhere injection works. And the configuration from Typoscript of course.
So yeah we could plug it via the signals.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$values = $this->contentDataProcessor->process(
$this->getContentObjectRenderer(),
$this->typoScriptConfiguration->getValueByPathOrDefaultValue("plugin.tx_solr.search.results.",[]),
$values
);

$this->view->assignMultiple($values);
} catch (SolrUnavailableException $e) {
Expand Down
8 changes: 8 additions & 0 deletions Configuration/TypoScript/Examples/DataProcessing/setup.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
plugin.tx_solr.search.results {
dataProcessing {
10 = MyNamespace\DataProcessing\MyDataProcessor
10 {
my_option = my_value
}
}
}