try to create forward compatibility with Flow 7.x forwards
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/3 Pipeline was successful
ci/woodpecker/push/functional-tests/2 Pipeline was successful
ci/woodpecker/push/functional-tests/4 Pipeline was successful
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/3 Pipeline was successful
ci/woodpecker/push/functional-tests/2 Pipeline was successful
ci/woodpecker/push/functional-tests/4 Pipeline was successful
This commit is contained in:
parent
713941b688
commit
9f3488f84e
2 changed files with 18 additions and 1 deletions
|
@ -6,6 +6,7 @@ namespace DigiComp\FluidRenderFunctions\Utils;
|
|||
|
||||
use TYPO3Fluid\Fluid\View\ViewInterface;
|
||||
|
||||
// @deprecated: drop this class, as soon as Flow 6.3 support drops
|
||||
class DummyView implements ViewInterface
|
||||
{
|
||||
public function assign($key, $value)
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace DigiComp\FluidRenderFunctions\Utils;
|
||||
|
||||
use DigiComp\FluidRenderFunctions\InvokeRenderFunctionInterface;
|
||||
use Neos\Flow\ObjectManagement\Proxy\ProxyInterface;
|
||||
use Neos\FluidAdaptor\Core\Rendering\RenderingContext;
|
||||
use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\NodeInterface;
|
||||
|
||||
|
@ -28,7 +29,22 @@ class NodeRenderTransfer implements InvokeRenderFunctionInterface
|
|||
|
||||
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);
|
||||
if ($reflector->implementsInterface(ProxyInterface::class)) {
|
||||
try {
|
||||
$reflector = new \ReflectionClass($reflector->getParentClass()->getName());
|
||||
} catch (\Exception $e) {
|
||||
// nothing, go with the first one
|
||||
}
|
||||
}
|
||||
$constructor = $reflector->getConstructor();
|
||||
|
||||
if ($constructor->getNumberOfRequiredParameters() > 0) {
|
||||
$context = new RenderingContext(new DummyView());
|
||||
} else {
|
||||
$context = new RenderingContext();
|
||||
}
|
||||
$context->getVariableProvider()->add($this->subjectName, $object);
|
||||
return \trim($this->node->evaluate($context));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue