PHP code example of omikron / oxid-factfinder
1. Go to this page and download the library: Download omikron/oxid-factfinder library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
omikron / oxid-factfinder example snippets
//src/Controller/SearchResultController.php:84
protected function fallback(): void
{
//this function could be used to implement fallback logic in case of any communication error.
$this->showJsonAndExit('Error: Unable to process the request.');
}
use Omikron\FactFinder\Oxid\Event\EnrichProxyDataEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class EnrichProxyDataEventSubscriber implements EventSubscriberInterface
{
public static function getSubscribedEvents(): array
{
return [EnrichProxyDataEvent::class => 'enrichData'];
}
public function enrichData(EnrichProxyDataEvent $event): void
{
$data = $event->getData();
$data['example_data'] = [
'some_data' => 'data_1',
'next_data' => 'data_2',
];
$event->setData($data);
}
}