try to create forward compatibility with Flow 7.x forwards
Some checks failed
ci/woodpecker/push/code-style Pipeline was successful
ci/woodpecker/push/functional-tests/3 Pipeline was successful
ci/woodpecker/push/functional-tests/2 Pipeline was successful
ci/woodpecker/push/functional-tests/1 Pipeline failed
ci/woodpecker/push/functional-tests/4 Pipeline was successful

This commit is contained in:
Ferdinand Kuhl 2024-06-01 23:33:12 +02:00
parent 713941b688
commit 08b5dd61c7
2 changed files with 9 additions and 1 deletions

View file

@ -6,6 +6,7 @@ namespace DigiComp\FluidRenderFunctions\Utils;
use TYPO3Fluid\Fluid\View\ViewInterface; use TYPO3Fluid\Fluid\View\ViewInterface;
// @deprecated: drop this class, as soon as Flow 6.3 support drops
class DummyView implements ViewInterface class DummyView implements ViewInterface
{ {
public function assign($key, $value) public function assign($key, $value)

View file

@ -28,7 +28,14 @@ class NodeRenderTransfer implements InvokeRenderFunctionInterface
public function __invoke($object): string public function __invoke($object): string
{ {
$context = new RenderingContext(new DummyView()); // @deprecated: drop the condition, if compatibility to Flow 6.3 can be dropped
$reflector = new \ReflectionClass(RenderingContext::class);
$constructor = $reflector->getConstructor();
if ($constructor->getNumberOfRequiredParameters() > 0) {
$context = new RenderingContext(new DummyView());
} else {
$context = new RenderingContext();
}
$context->getVariableProvider()->add($this->subjectName, $object); $context->getVariableProvider()->add($this->subjectName, $object);
return \trim($this->node->evaluate($context)); return \trim($this->node->evaluate($context));
} }