diff --git a/Classes/Domain/Model/Feedback/Operations/ReloadContentOutOfBand.php b/Classes/Domain/Model/Feedback/Operations/ReloadContentOutOfBand.php index 792fcd72f0..83ae60847b 100644 --- a/Classes/Domain/Model/Feedback/Operations/ReloadContentOutOfBand.php +++ b/Classes/Domain/Model/Feedback/Operations/ReloadContentOutOfBand.php @@ -132,7 +132,20 @@ protected function renderContent(ControllerContext $controllerContext): string|R if ($this->nodeDomAddress) { $fusionView = new FusionView(); - $fusionView->setControllerContext($controllerContext); + + $fakeActionRequest = clone $controllerContext->getRequest(); + $fakeActionRequest->setControllerPackageKey('Neos.Neos'); + $fakeActionRequest->setControllerName('Frontend\\Node'); + $fakeActionRequest->setControllerActionName('edit'); + + $fakeControllerContext = new ControllerContext( + $fakeActionRequest, + $controllerContext->getResponse(), + $controllerContext->getArguments(), + $controllerContext->getUriBuilder(), + ); + + $fusionView->setControllerContext($fakeControllerContext); $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..f35e488232 100644 --- a/Classes/Domain/Model/Feedback/Operations/RenderContentOutOfBand.php +++ b/Classes/Domain/Model/Feedback/Operations/RenderContentOutOfBand.php @@ -178,7 +178,20 @@ protected function renderContent(ControllerContext $controllerContext): string|R $parentDomAddress = $this->getParentDomAddress(); if ($parentDomAddress) { $fusionView = new FusionView(); - $fusionView->setControllerContext($controllerContext); + + $fakeActionRequest = clone $controllerContext->getRequest(); + $fakeActionRequest->setControllerPackageKey('Neos.Neos'); + $fakeActionRequest->setControllerName('Frontend\\Node'); + $fakeActionRequest->setControllerActionName('edit'); + + $fakeControllerContext = new ControllerContext( + $fakeActionRequest, + $controllerContext->getResponse(), + $controllerContext->getArguments(), + $controllerContext->getUriBuilder(), + ); + + $fusionView->setControllerContext($fakeControllerContext); $fusionView->assign('value', $parentNode); $fusionView->setFusionPath($parentDomAddress->getFusionPath()); diff --git a/Classes/Fusion/Helper/NodeInfoHelper.php b/Classes/Fusion/Helper/NodeInfoHelper.php index d85ac50063..4049051ff8 100644 --- a/Classes/Fusion/Helper/NodeInfoHelper.php +++ b/Classes/Fusion/Helper/NodeInfoHelper.php @@ -211,7 +211,7 @@ protected function getUriInformation(Node $node, ControllerContext $controllerCo if (!$node->nodeType->isOfType($this->documentNodeTypeRole)) { return $nodeInfo; } - $nodeInfo['uri'] = $this->previewUri($node, $controllerContext); + $nodeInfo['uri'] = $this->editUri($node, $controllerContext); return $nodeInfo; } @@ -442,6 +442,14 @@ public function uri(Node|NodeAddress $nodeAddress, ControllerContext $controller return (string)NodeUriBuilder::fromRequest($controllerContext->getRequest())->uriFor($nodeAddress); } + public function editUri(Node $node, ControllerContext $controllerContext): string + { + $contentRepository = $this->contentRepositoryRegistry->get($node->subgraphIdentity->contentRepositoryId); + $nodeAddressFactory = NodeAddressFactory::create($contentRepository); + $nodeAddress = $nodeAddressFactory->createFromNode($node); + return (string)NodeUriBuilder::fromRequest($controllerContext->getRequest())->editUriFor($nodeAddress); + } + public function previewUri(Node $node, ControllerContext $controllerContext): string { $contentRepository = $this->contentRepositoryRegistry->get($node->subgraphIdentity->contentRepositoryId); diff --git a/Configuration/Settings.yaml b/Configuration/Settings.yaml index 7e7ee51eaf..64f4910097 100644 --- a/Configuration/Settings.yaml +++ b/Configuration/Settings.yaml @@ -137,7 +137,7 @@ Neos: personalWorkspace: '${Neos.Ui.Workspace.getPersonalWorkspace(contentRepositoryId)}' ui: contentCanvas: - src: '${Neos.Ui.NodeInfo.uri(documentNode, controllerContext)}' + src: '${Neos.Ui.NodeInfo.editUri(documentNode, controllerContext)}' backgroundColor: '${Configuration.setting(''Neos.Neos.Ui.contentCanvas.backgroundColor'')}' debugMode: false editPreviewMode: '${q(user).property("preferences.preferences")["contentEditing.editPreviewMode"] || Configuration.setting(''Neos.Neos.userInterface.defaultEditPreviewMode'')}' diff --git a/Tests/IntegrationTests/TestDistribution/composer.json b/Tests/IntegrationTests/TestDistribution/composer.json index dc3ed64728..9d84b93d73 100644 --- a/Tests/IntegrationTests/TestDistribution/composer.json +++ b/Tests/IntegrationTests/TestDistribution/composer.json @@ -29,7 +29,8 @@ "patches": { "neos/neos-development-collection": { "!!!FEATURE: (Neos.Neos) Track created nodes in PendingChangesProjection": "https://github.com/neos/neos-development-collection/pull/4393.patch", - "BUGFIX: (Neos.Neos) Restore show action of ContentDimensionsController": "https://github.com/neos/neos-development-collection/pull/4395.patch" + "BUGFIX: (Neos.Neos) Restore show action of ContentDimensionsController": "https://github.com/neos/neos-development-collection/pull/4395.patch", + "FEATURE: Edit preview mode support for Neos 9": "https://github.com/neos/neos-development-collection/pull/4067.patch" } } },