diff --git a/Classes/Domain/Model/Feedback/Operations/ReloadContentOutOfBand.php b/Classes/Domain/Model/Feedback/Operations/ReloadContentOutOfBand.php index fc511798de..019504574b 100644 --- a/Classes/Domain/Model/Feedback/Operations/ReloadContentOutOfBand.php +++ b/Classes/Domain/Model/Feedback/Operations/ReloadContentOutOfBand.php @@ -23,7 +23,7 @@ use Neos\Neos\Ui\Domain\Model\AbstractFeedback; use Neos\Neos\Ui\Domain\Model\FeedbackInterface; use Neos\Neos\Ui\Domain\Model\RenderedNodeDomAddress; -use Neos\Neos\View\FusionView; +use Neos\Neos\Ui\View\OutOfBandRenderingViewFactory; use Psr\Http\Message\ResponseInterface; class ReloadContentOutOfBand extends AbstractFeedback @@ -53,6 +53,9 @@ class ReloadContentOutOfBand extends AbstractFeedback #[Flow\Inject] protected RenderingModeService $renderingModeService; + #[Flow\Inject] + protected OutOfBandRenderingViewFactory $outOfBandRenderingViewFactory; + public function setNode(Node $node): void { $this->node = $node; @@ -137,14 +140,14 @@ protected function renderContent(ControllerContext $controllerContext): string|R if ($this->nodeDomAddress) { $renderingMode = $this->renderingModeService->findByCurrentUser(); - $fusionView = new FusionView(); - $fusionView->setControllerContext($controllerContext); - $fusionView->setOption('renderingModeName', $renderingMode->name); + $view = $this->outOfBandRenderingViewFactory->resolveView(); + $view->setControllerContext($controllerContext); + $view->setOption('renderingModeName', $renderingMode->name); - $fusionView->assign('value', $this->node); - $fusionView->setFusionPath($this->nodeDomAddress->getFusionPathForContentRendering()); + $view->assign('value', $this->node); + $view->setRenderingEntryPoint($this->nodeDomAddress->getFusionPathForContentRendering()); - return $fusionView->render(); + return $view->render(); } } diff --git a/Classes/Domain/Model/Feedback/Operations/RenderContentOutOfBand.php b/Classes/Domain/Model/Feedback/Operations/RenderContentOutOfBand.php index 409ad394e7..d5714f8641 100644 --- a/Classes/Domain/Model/Feedback/Operations/RenderContentOutOfBand.php +++ b/Classes/Domain/Model/Feedback/Operations/RenderContentOutOfBand.php @@ -1,5 +1,4 @@ node = $node; @@ -183,14 +189,14 @@ protected function renderContent(ControllerContext $controllerContext): string|R if ($parentDomAddress) { $renderingMode = $this->renderingModeService->findByCurrentUser(); - $fusionView = new FusionView(); - $fusionView->setControllerContext($controllerContext); - $fusionView->setOption('renderingModeName', $renderingMode->name); + $view = $this->outOfBandRenderingViewFactory->resolveView(); + $view->setControllerContext($controllerContext); + $view->setOption('renderingModeName', $renderingMode->name); - $fusionView->assign('value', $parentNode); - $fusionView->setFusionPath($parentDomAddress->getFusionPath()); + $view->assign('value', $parentNode); + $view->setRenderingEntryPoint($parentDomAddress->getFusionPath()); - return $fusionView->render(); + return $view->render(); } } diff --git a/Classes/View/OutOfBandRenderingCapable.php b/Classes/View/OutOfBandRenderingCapable.php new file mode 100644 index 0000000000..31cb7a5809 --- /dev/null +++ b/Classes/View/OutOfBandRenderingCapable.php @@ -0,0 +1,30 @@ +setFusionPath($renderingEntryPoint); + } +} diff --git a/Classes/View/OutOfBandRenderingViewFactory.php b/Classes/View/OutOfBandRenderingViewFactory.php new file mode 100644 index 0000000000..23f0620dc4 --- /dev/null +++ b/Classes/View/OutOfBandRenderingViewFactory.php @@ -0,0 +1,54 @@ +viewObjectName)) { + throw new \DomainException( + 'Declared view for out of band rendering (' . $this->viewObjectName . ') does not exist', + 1697821296 + ); + } + $view = new $this->viewObjectName(); + if (!$view instanceof AbstractView) { + throw new \DomainException( + 'Declared view (' . $this->viewObjectName . ') does not implement ' . AbstractView::class + . ' required for out-of-band rendering', + 1697821429 + ); + } + if (!$view instanceof OutOfBandRenderingCapable) { + throw new \DomainException( + 'Declared view (' . $this->viewObjectName . ') does not implement ' . OutOfBandRenderingCapable::class + . ' required for out-of-band rendering', + 1697821364 + ); + } + + return $view; + } +} diff --git a/Configuration/Settings.yaml b/Configuration/Settings.yaml index 92de6e127f..414f5f4e77 100644 --- a/Configuration/Settings.yaml +++ b/Configuration/Settings.yaml @@ -191,6 +191,8 @@ Neos: 'Neos.Neos.Ui:MoveBefore': Neos\Neos\Ui\Domain\Model\Changes\MoveBefore 'Neos.Neos.Ui:MoveAfter': Neos\Neos\Ui\Domain\Model\Changes\MoveAfter 'Neos.Neos.Ui:MoveInto': Neos\Neos\Ui\Domain\Model\Changes\MoveInto + outOfBandRendering: + viewObjectName: 'Neos\Neos\Ui\View\OutOfBandRenderingFusionView' Flow: security: authentication: