65 lines
1.7 KiB
PHP
65 lines
1.7 KiB
PHP
|
<?php
|
||
|
|
||
|
declare(strict_types=1);
|
||
|
|
||
|
namespace DigiComp\FluidJsonViews\ViewHelpers;
|
||
|
|
||
|
use DigiComp\FluidJsonViews\ViewHelpers\Controller\FluidJsonController;
|
||
|
use DigiComp\FluidRenderFunctions\InvokeRenderFunctionInterface;
|
||
|
use Neos\Flow\Annotations as Flow;
|
||
|
use Neos\Flow\Mvc\Exception\InfiniteLoopException;
|
||
|
use Neos\Flow\Mvc\Exception\StopActionException;
|
||
|
use Neos\Flow\Persistence\Doctrine\QueryResult;
|
||
|
use Neos\FluidAdaptor\Core\Widget\AbstractWidgetViewHelper;
|
||
|
use Neos\FluidAdaptor\Core\Widget\Exception\InvalidControllerException;
|
||
|
use Neos\FluidAdaptor\Core\Widget\Exception\MissingControllerException;
|
||
|
|
||
|
class FluidJsonViewHelper extends AbstractWidgetViewHelper
|
||
|
{
|
||
|
/**
|
||
|
* @inheritDoc
|
||
|
* @Flow\Inject
|
||
|
* @var FluidJsonController
|
||
|
*/
|
||
|
protected $controller;
|
||
|
|
||
|
/**
|
||
|
* @inheritDoc
|
||
|
*/
|
||
|
protected $ajaxWidget = true;
|
||
|
|
||
|
/**
|
||
|
* @inheritDoc
|
||
|
*/
|
||
|
public function initializeArguments(): void
|
||
|
{
|
||
|
parent::initializeArguments();
|
||
|
|
||
|
$this->registerArgument('objects', QueryResult::class, 'Objects to show in table.', true);
|
||
|
$this->registerArgument(
|
||
|
'renderFunction',
|
||
|
InvokeRenderFunctionInterface::class,
|
||
|
'callabe to use to render single object',
|
||
|
true
|
||
|
);
|
||
|
$this->registerArgument(
|
||
|
'searchProperties',
|
||
|
'array',
|
||
|
'an array of pathes, which should be used during search evaluation',
|
||
|
false,
|
||
|
[]
|
||
|
);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @throws InfiniteLoopException
|
||
|
* @throws InvalidControllerException
|
||
|
* @throws MissingControllerException
|
||
|
* @throws StopActionException
|
||
|
*/
|
||
|
public function render(): string
|
||
|
{
|
||
|
return $this->initiateSubRequest();
|
||
|
}
|
||
|
}
|