All checks were successful
ci/woodpecker/push/code-style Pipeline was successful
ci/woodpecker/push/functional-tests/1 Pipeline was successful
ci/woodpecker/push/functional-tests/2 Pipeline was successful
ci/woodpecker/push/functional-tests/3 Pipeline was successful
ci/woodpecker/push/functional-tests/4 Pipeline was successful
72 lines
1.9 KiB
PHP
72 lines
1.9 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace DigiComp\FluidJsonViews\ViewHelpers;
|
|
|
|
use DigiComp\FluidJsonViews\ViewHelpers\Controller\FluidJsonController;
|
|
use DigiComp\FluidRenderFunctions\ViewHelpers\Traits\ValidateRenderFunctionTrait;
|
|
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
|
|
{
|
|
use ValidateRenderFunctionTrait;
|
|
|
|
/**
|
|
* @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',
|
|
'string',
|
|
'callabe to use to render single object',
|
|
true
|
|
);
|
|
$this->registerArgument(
|
|
'searchProperties',
|
|
'array',
|
|
'an array of pathes, which should be used during search evaluation',
|
|
false,
|
|
[]
|
|
);
|
|
}
|
|
|
|
public function validateArguments()
|
|
{
|
|
parent::validateArguments();
|
|
$this->validateRenderFunctionArgument('renderFunction');
|
|
}
|
|
|
|
/**
|
|
* @throws InfiniteLoopException
|
|
* @throws InvalidControllerException
|
|
* @throws MissingControllerException
|
|
* @throws StopActionException
|
|
*/
|
|
public function render(): string
|
|
{
|
|
return $this->initiateSubRequest();
|
|
}
|
|
}
|