diff --git a/Classes/Domain/Model/Feedback/Operations/ReloadContentOutOfBand.php b/Classes/Domain/Model/Feedback/Operations/ReloadContentOutOfBand.php index 792fcd72f0..07a6108a3f 100644 --- a/Classes/Domain/Model/Feedback/Operations/ReloadContentOutOfBand.php +++ b/Classes/Domain/Model/Feedback/Operations/ReloadContentOutOfBand.php @@ -11,6 +11,7 @@ * source code. */ +use Neos\Neos\Domain\Service\RenderingModeService; use Neos\Neos\FrontendRouting\NodeAddressFactory; use Neos\ContentRepository\Core\Projection\ContentGraph\Node; use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry; @@ -49,6 +50,9 @@ class ReloadContentOutOfBand extends AbstractFeedback */ protected $contentRepositoryRegistry; + #[Flow\Inject] + protected RenderingModeService $renderingModeService; + public function setNode(Node $node): void { $this->node = $node; @@ -131,8 +135,11 @@ 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); $fusionView->assign('value', $this->node); $fusionView->setFusionPath($this->nodeDomAddress->getFusionPathForContentRendering()); diff --git a/Classes/Domain/Model/Feedback/Operations/RenderContentOutOfBand.php b/Classes/Domain/Model/Feedback/Operations/RenderContentOutOfBand.php index c3f9539372..409ad394e7 100644 --- a/Classes/Domain/Model/Feedback/Operations/RenderContentOutOfBand.php +++ b/Classes/Domain/Model/Feedback/Operations/RenderContentOutOfBand.php @@ -12,6 +12,7 @@ */ use Neos\ContentRepository\Core\Projection\ContentGraph\Node; +use Neos\Neos\Domain\Service\RenderingModeService; use Neos\Neos\FrontendRouting\NodeAddressFactory; use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry; use Neos\Flow\Annotations as Flow; @@ -59,6 +60,9 @@ class RenderContentOutOfBand extends AbstractFeedback */ protected $contentRepositoryRegistry; + #[Flow\Inject] + protected RenderingModeService $renderingModeService; + public function setNode(Node $node): void { $this->node = $node; @@ -177,8 +181,11 @@ protected function renderContent(ControllerContext $controllerContext): string|R $parentDomAddress = $this->getParentDomAddress(); if ($parentDomAddress) { + $renderingMode = $this->renderingModeService->findByCurrentUser(); + $fusionView = new FusionView(); $fusionView->setControllerContext($controllerContext); + $fusionView->setOption('renderingModeName', $renderingMode->name); $fusionView->assign('value', $parentNode); $fusionView->setFusionPath($parentDomAddress->getFusionPath()); diff --git a/Resources/Private/Fusion/Prototypes/Page.fusion b/Resources/Private/Fusion/Prototypes/Page.fusion index 61dedd0bc4..b07bb56216 100644 --- a/Resources/Private/Fusion/Prototypes/Page.fusion +++ b/Resources/Private/Fusion/Prototypes/Page.fusion @@ -19,7 +19,7 @@ prototype(Neos.Neos:Page) { @process.json = ${Json.stringify(value)} @process.wrapInJsObject = ${''} - @if.inBackend = ${Neos.Node.inBackend(documentNode)} + @if.inBackend = ${renderingMode.isEdit || renderingMode.isPreview} // We need to ensure the JS backend information is always up to date, especially // when child nodes change. Otherwise errors like the following might happen: @@ -35,11 +35,11 @@ prototype(Neos.Neos:Page) { entryIdentifier { jsBackendInfo = 'javascriptBackendInformation' documentNode = ${Neos.Caching.entryIdentifierForNode(documentNode)} - inBackend = ${Neos.Node.inBackend(documentNode)} + inBackend = ${renderingMode.isEdit || renderingMode.isPreview} } entryTags { 1 = ${Neos.Caching.nodeTag(documentNode)} - 2 = ${Neos.Node.inBackend(documentNode) ? Neos.Caching.descendantOfTag(documentNode) : null} + 2 = ${(renderingMode.isEdit || renderingMode.isPreview) ? Neos.Caching.descendantOfTag(documentNode) : null} } } } @@ -51,18 +51,18 @@ prototype(Neos.Neos:Page) { compiledResourcePackage = ${Neos.Ui.StaticResources.compiledResourcePackage()} sectionName = 'guestFrameApplication' - @if.inBackend = ${Neos.Node.inBackend(documentNode)} + @if.inBackend = ${renderingMode.isEdit || renderingMode.isPreview} } } neosBackendContainer = '
' neosBackendContainer.@position = 'before closingBodyTag' - neosBackendContainer.@if.inBackend = ${Neos.Node.inBackend(documentNode)} + neosBackendContainer.@if.inBackend = ${renderingMode.isEdit || renderingMode.isPreview} neosBackendNotification = Neos.Fusion:Template { @position = 'before closingBodyTag' templatePath = 'resource://Neos.Neos.Ui/Private/Templates/Backend/GuestNotificationScript.html' - @if.inBackend = ${Neos.Node.inBackend(documentNode)} + @if.inBackend = ${renderingMode.isEdit || renderingMode.isPreview} } @exceptionHandler = 'Neos\\Neos\\Ui\\Fusion\\ExceptionHandler\\PageExceptionHandler' diff --git a/Resources/Private/Fusion/Prototypes/Shortcut.fusion b/Resources/Private/Fusion/Prototypes/Shortcut.fusion index 69f3a7ea29..23d36fe282 100644 --- a/Resources/Private/Fusion/Prototypes/Shortcut.fusion +++ b/Resources/Private/Fusion/Prototypes/Shortcut.fusion @@ -9,7 +9,7 @@ prototype(Neos.Neos:Page) { } @if { - inBackend = ${Neos.Node.inBackend(documentNode)} + inBackend = ${renderingMode.isEdit || renderingMode.isPreview} isShortcut = ${q(node).is('[instanceof Neos.Neos:Shortcut]')} } }