adjusting to new storage location of render functions
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

This commit is contained in:
Ferdinand Kuhl 2024-06-02 04:07:21 +02:00
parent 7585baee36
commit baf5636bd3
4 changed files with 19 additions and 4 deletions

View file

@ -11,6 +11,7 @@ use Doctrine\ORM\Query\Parameter;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Persistence\Doctrine\Query;
use Neos\FluidAdaptor\Core\Widget\AbstractWidgetController;
use Neos\FluidAdaptor\View\TemplateView;
use Neos\Utility\TypeHandling;
class FluidJsonController extends AbstractWidgetController
@ -80,6 +81,12 @@ class FluidJsonController extends AbstractWidgetController
public function indexAction()
{
$this->view->assign('entityClassName', $this->query->getType());
if ($this->view instanceof TemplateView) {
$renderingContext = $this->request
->getInternalArgument('__widgetContext')
->getViewHelperChildNodeRenderingContext();
$this->view->assignMultiple($renderingContext->getVariableProvider()->getAll());
}
}
/**

View file

@ -5,7 +5,7 @@ declare(strict_types=1);
namespace DigiComp\FluidJsonViews\ViewHelpers;
use DigiComp\FluidJsonViews\ViewHelpers\Controller\FluidJsonController;
use DigiComp\FluidRenderFunctions\InvokeRenderFunctionInterface;
use DigiComp\FluidRenderFunctions\ViewHelpers\Traits\ValidateRenderFunctionTrait;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Mvc\Exception\InfiniteLoopException;
use Neos\Flow\Mvc\Exception\StopActionException;
@ -16,6 +16,8 @@ use Neos\FluidAdaptor\Core\Widget\Exception\MissingControllerException;
class FluidJsonViewHelper extends AbstractWidgetViewHelper
{
use ValidateRenderFunctionTrait;
/**
* @inheritDoc
* @Flow\Inject
@ -38,7 +40,7 @@ class FluidJsonViewHelper extends AbstractWidgetViewHelper
$this->registerArgument('objects', QueryResult::class, 'Objects to show in table.', true);
$this->registerArgument(
'renderFunction',
InvokeRenderFunctionInterface::class,
'string',
'callabe to use to render single object',
true
);
@ -51,6 +53,12 @@ class FluidJsonViewHelper extends AbstractWidgetViewHelper
);
}
public function validateArguments()
{
parent::validateArguments();
$this->validateRenderFunctionArgument('renderFunction');
}
/**
* @throws InfiniteLoopException
* @throws InvalidControllerException

View file

@ -7,7 +7,7 @@ Let me provide you an example:
<rf:registerRenderFunction as="renderTag">
{subject.name}
</rf:registerRenderFunction>
<fj:fluidJson objects="{tags}" renderFunction="{renderTag}" searchProperties="{0: 'name'}">
<fj:fluidJson objects="{tags}" renderFunction="renderTag" searchProperties="{0: 'name'}">
<a href="{dataUri}">jsonView</a>
</fj:fluidJson>
```

View file

@ -3,6 +3,6 @@
<rf:registerRenderFunction as="renderTag">
{subject.name}
</rf:registerRenderFunction>
<fj:fluidJson objects="{tags}" renderFunction="{renderTag}" searchProperties="{0: 'name'}">
<fj:fluidJson objects="{tags}" renderFunction="renderTag" searchProperties="{0: 'name'}">
<a href="{dataUri}">jsonView</a>
</fj:fluidJson>