Feature: #82488 - Possibility to modify the display results before FluidView assignment
See forge#82488
Description
To manipulate the data of the search results prior to rendering them in the frontend a
hook has been introduced at the end of the
get method, called
get.
The hook can modify all data just before it is passed to fluid.
Basic Usage
Registration of the new hook in ext_ of your custom extension.
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['indexed_search']['pi1_hooks']['getDisplayResults_postProc'] = \Vendor\ExtensionName\Hooks\CustomHook::class;
Copied!
CustomHook class example
\Vendor\
<?php
declare(strict_types = 1);
namespace Vendor\ExtensionName\Hooks;
class CustomHook
{
/**
* @param array $result
* @return array
*/
public function getDisplayResults_postProc(array $result): array
{
if ($result['count'] > 0) {
foreach($result['rows'] as $rowIndex => $row) {
$result['rows'][$rowIndex]['description'] = \str_replace('foo', 'bar', $row['description']);
}
}
return $result;
}
}
Copied!