Ferdinand Kuhl
0de901d45c
Some checks failed
ci/woodpecker/push/code-style Pipeline was successful
ci/woodpecker/push/functional-tests/1 Pipeline failed
ci/woodpecker/push/functional-tests/2 Pipeline failed
ci/woodpecker/push/functional-tests/3 Pipeline failed
ci/woodpecker/push/functional-tests/4 Pipeline failed
35 lines
896 B
PHP
35 lines
896 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace DigiComp\FluidRenderFunctions\Utils;
|
|
|
|
use DigiComp\FluidRenderFunctions\InvokeRenderFunctionInterface;
|
|
use Neos\FluidAdaptor\Core\Rendering\RenderingContext;
|
|
use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\NodeInterface;
|
|
|
|
class NodeRenderTransfer implements InvokeRenderFunctionInterface
|
|
{
|
|
/**
|
|
* @var NodeInterface
|
|
*/
|
|
protected NodeInterface $node;
|
|
|
|
/**
|
|
* @var string
|
|
*/
|
|
protected string $subjectName;
|
|
|
|
public function __construct(NodeInterface $node, string $subjectName = 'object')
|
|
{
|
|
$this->node = $node;
|
|
$this->subjectName = $subjectName;
|
|
}
|
|
|
|
public function __invoke($object): string
|
|
{
|
|
$context = new RenderingContext(new DummyView());
|
|
$context->getVariableProvider()->add($this->subjectName, $object);
|
|
return \trim($this->node->evaluate($context));
|
|
}
|
|
}
|