From be92345e7b84e6e67d30144f6f05b1f22abcc6ce Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Sun, 12 Nov 2023 10:17:17 +0100 Subject: [PATCH 1/5] TASK: #4396 prefer renderingMode::isEdit over node::isLive --- .../ContentElementEditableImplementation.php | 13 ++++-- .../ContentElementWrappingImplementation.php | 7 +++ .../ExceptionHandlers/NodeWrappingHandler.php | 24 +++++----- .../Fusion/ExceptionHandlers/PageHandler.php | 12 +++-- .../Service/ContentElementEditableService.php | 22 +-------- .../Service/ContentElementWrappingService.php | 45 +++---------------- .../ContentElement/EditableViewHelper.php | 11 ++++- .../ContentElement/WrapViewHelper.php | 8 ++++ 8 files changed, 59 insertions(+), 83 deletions(-) diff --git a/Neos.Neos/Classes/Fusion/ContentElementEditableImplementation.php b/Neos.Neos/Classes/Fusion/ContentElementEditableImplementation.php index 6ddcdc300ee..244031cb1d6 100644 --- a/Neos.Neos/Classes/Fusion/ContentElementEditableImplementation.php +++ b/Neos.Neos/Classes/Fusion/ContentElementEditableImplementation.php @@ -18,6 +18,7 @@ use Neos\Flow\Annotations as Flow; use Neos\Flow\Security\Authorization\PrivilegeManagerInterface; use Neos\Fusion\FusionObjects\AbstractFusionObject; +use Neos\Neos\Domain\Model\RenderingMode; use Neos\Neos\Service\ContentElementEditableService; /** @@ -56,18 +57,24 @@ public function evaluate() { $content = $this->getValue(); + /** @var RenderingMode $renderingMode */ + $renderingMode = $this->runtime->fusionGlobals->get('renderingMode'); + if (!$renderingMode->isEdit) { + return $content; + } + $node = $this->fusionValue('node'); if (!$node instanceof Node) { return $content; } - /** @var string $property */ - $property = $this->fusionValue('property'); - if (!$this->privilegeManager->isPrivilegeTargetGranted('Neos.Neos:Backend.GeneralAccess')) { return $content; } + /** @var string $property */ + $property = $this->fusionValue('property'); + return $this->contentElementEditableService->wrapContentProperty($node, $property, $content); } } diff --git a/Neos.Neos/Classes/Fusion/ContentElementWrappingImplementation.php b/Neos.Neos/Classes/Fusion/ContentElementWrappingImplementation.php index ea8ca0eb6a2..8d2439a38dd 100644 --- a/Neos.Neos/Classes/Fusion/ContentElementWrappingImplementation.php +++ b/Neos.Neos/Classes/Fusion/ContentElementWrappingImplementation.php @@ -18,6 +18,7 @@ use Neos\Flow\Annotations as Flow; use Neos\Flow\Security\Authorization\PrivilegeManagerInterface; use Neos\Fusion\FusionObjects\AbstractFusionObject; +use Neos\Neos\Domain\Model\RenderingMode; use Neos\Neos\Service\ContentElementWrappingService; /** @@ -66,6 +67,12 @@ public function evaluate() { $content = $this->getValue(); + /** @var RenderingMode $renderingMode */ + $renderingMode = $this->runtime->fusionGlobals->get('renderingMode'); + if (!$renderingMode->isEdit) { + return $content; + } + $node = $this->fusionValue('node'); if (!$node instanceof Node) { return $content; diff --git a/Neos.Neos/Classes/Fusion/ExceptionHandlers/NodeWrappingHandler.php b/Neos.Neos/Classes/Fusion/ExceptionHandlers/NodeWrappingHandler.php index 200a868cc41..0cf8dc51b74 100644 --- a/Neos.Neos/Classes/Fusion/ExceptionHandlers/NodeWrappingHandler.php +++ b/Neos.Neos/Classes/Fusion/ExceptionHandlers/NodeWrappingHandler.php @@ -21,6 +21,7 @@ use Neos\Flow\Utility\Environment; use Neos\Fusion\Core\ExceptionHandlers\AbstractRenderingExceptionHandler; use Neos\Fusion\Core\ExceptionHandlers\ContextDependentHandler; +use Neos\Neos\Domain\Model\RenderingMode; use Neos\Neos\Service\ContentElementWrappingService; /** @@ -72,19 +73,20 @@ protected function handle($fusionPath, \Exception $exception, $referenceCode): s if (isset($currentContext['node'])) { /** @var Node $node */ $node = $currentContext['node']; - $contentRepositoryId = $node->subgraphIdentity->contentRepositoryId; - $contentRepository = $this->contentRepositoryRegistry->get($contentRepositoryId); - $workspace = $contentRepository->getWorkspaceFinder()->findOneByCurrentContentStreamId( - $node->subgraphIdentity->contentStreamId - ); + + /** @var RenderingMode $renderingMode */ + $renderingMode = $this->runtime->fusionGlobals->get('renderingMode'); $applicationContext = $this->environment->getContext(); - if ( - $applicationContext->isProduction() - && $this->privilegeManager->isPrivilegeTargetGranted('Neos.Neos:Backend.GeneralAccess') - && !is_null($workspace) - && !$workspace->workspaceName->isLive() - ) { + if (!$renderingMode->isEdit) { + return $output; + } + + if (!$this->privilegeManager->isPrivilegeTargetGranted('Neos.Neos:Backend.GeneralAccess')) { + return $output; + } + + if ($applicationContext->isProduction()) { $output = '
Failed to render element' . $output . '
'; diff --git a/Neos.Neos/Classes/Fusion/ExceptionHandlers/PageHandler.php b/Neos.Neos/Classes/Fusion/ExceptionHandlers/PageHandler.php index 3928e1dcc25..ddcb58c53fe 100644 --- a/Neos.Neos/Classes/Fusion/ExceptionHandlers/PageHandler.php +++ b/Neos.Neos/Classes/Fusion/ExceptionHandlers/PageHandler.php @@ -24,6 +24,7 @@ use Neos\FluidAdaptor\View\StandaloneView; use Neos\Fusion\Core\ExceptionHandlers\AbstractRenderingExceptionHandler; use Neos\Fusion\Core\ExceptionHandlers\HtmlMessageHandler; +use Neos\Neos\Domain\Model\RenderingMode; use Neos\Neos\Service\ContentElementWrappingService; use Psr\Http\Message\ResponseInterface; @@ -86,14 +87,11 @@ protected function handle($fusionPath, \Exception $exception, $referenceCode) } if (!is_null($documentNode)) { - $contentRepositoryId = $documentNode->subgraphIdentity->contentRepositoryId; - $contentRepository = $this->contentRepositoryRegistry->get($contentRepositoryId); - $workspace = $contentRepository->getWorkspaceFinder()->findOneByCurrentContentStreamId( - $documentNode->subgraphIdentity->contentStreamId - ); + /** @var RenderingMode $renderingMode */ + $renderingMode = $this->runtime->fusionGlobals->get('renderingMode'); if ( - $workspace && !$workspace->workspaceName->isLive() - && $this->privilegeManager->isPrivilegeTargetGranted('Neos.Neos:Backend.GeneralAccess') + $this->privilegeManager->isPrivilegeTargetGranted('Neos.Neos:Backend.GeneralAccess') + && $renderingMode->isEdit ) { $isBackend = true; $fluidView->assign( diff --git a/Neos.Neos/Classes/Service/ContentElementEditableService.php b/Neos.Neos/Classes/Service/ContentElementEditableService.php index 811dc634a65..16e2159fa9a 100644 --- a/Neos.Neos/Classes/Service/ContentElementEditableService.php +++ b/Neos.Neos/Classes/Service/ContentElementEditableService.php @@ -14,14 +14,12 @@ namespace Neos\Neos\Service; -use Neos\ContentRepository\Core\ContentRepository; -use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; -use Neos\Neos\FrontendRouting\NodeAddressFactory; use Neos\ContentRepository\Core\Projection\ContentGraph\Node; use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry; use Neos\Flow\Annotations as Flow; use Neos\Flow\Security\Authorization\PrivilegeManagerInterface; use Neos\Fusion\Service\HtmlAugmenter as FusionHtmlAugmenter; +use Neos\Neos\FrontendRouting\NodeAddressFactory; /** * The content element editable service adds the necessary markup around @@ -56,15 +54,6 @@ public function wrapContentProperty(Node $node, string $property, string $conten $node->subgraphIdentity->contentRepositoryId ); - if ( - $this->isContentStreamOfLiveWorkspace( - $node->subgraphIdentity->contentStreamId, - $contentRepository - ) - ) { - return $content; - } - // TODO: permissions //if (!$this->nodeAuthorizationService->isGrantedToEditNode($node)) { // return $content; @@ -79,13 +68,4 @@ public function wrapContentProperty(Node $node, string $property, string $conten return $this->htmlAugmenter->addAttributes($content, $attributes, 'span'); } - - private function isContentStreamOfLiveWorkspace( - ContentStreamId $contentStreamId, - ContentRepository $contentRepository - ): bool { - return $contentRepository->getWorkspaceFinder() - ->findOneByCurrentContentStreamId($contentStreamId) - ?->workspaceName->isLive() ?: false; - } } diff --git a/Neos.Neos/Classes/Service/ContentElementWrappingService.php b/Neos.Neos/Classes/Service/ContentElementWrappingService.php index 4851b49da2e..47b224e334c 100644 --- a/Neos.Neos/Classes/Service/ContentElementWrappingService.php +++ b/Neos.Neos/Classes/Service/ContentElementWrappingService.php @@ -14,15 +14,13 @@ namespace Neos\Neos\Service; -use Neos\ContentRepository\Core\ContentRepository; use Neos\ContentRepository\Core\Projection\ContentGraph\Node; -use Neos\Neos\FrontendRouting\NodeAddressFactory; -use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry; use Neos\Flow\Annotations as Flow; use Neos\Flow\Security\Authorization\PrivilegeManagerInterface; use Neos\Flow\Session\SessionInterface; use Neos\Fusion\Service\HtmlAugmenter as FusionHtmlAugmenter; +use Neos\Neos\FrontendRouting\NodeAddressFactory; use Neos\Neos\Ui\Domain\Service\UserLocaleService; use Neos\Neos\Ui\Fusion\Helper\NodeInfoHelper; @@ -86,15 +84,6 @@ public function wrapContentObject( $node->subgraphIdentity->contentRepositoryId ); - if ( - $this->isContentStreamOfLiveWorkspace( - $node->subgraphIdentity->contentStreamId, - $contentRepository - ) - ) { - return $content; - } - // TODO: reenable permissions //if ($this->nodeAuthorizationService->isGrantedToEditNode($node) === false) { // return $content; @@ -134,12 +123,10 @@ public function wrapCurrentDocumentMetadata( string $fusionPath, array $additionalAttributes = [], ): string { - $contentRepository = $this->contentRepositoryRegistry->get( - $node->subgraphIdentity->contentRepositoryId - ); - if ($this->needsMetadata($node, $contentRepository, true) === false) { - return $content; - } + // TODO: reenable permissions + //if ($this->nodeAuthorizationService->isGrantedToEditNode($node) === false) { + // return $content; + //} $attributes = $additionalAttributes; $attributes['data-__neos-fusion-path'] = $fusionPath; @@ -168,26 +155,4 @@ protected function addCssClasses(array $attributes, Node $node, array $initialCl return $attributes; } - - protected function needsMetadata( - Node $node, - ContentRepository $contentRepository, - bool $renderCurrentDocumentMetadata - ): bool { - return $this->isContentStreamOfLiveWorkspace( - $node->subgraphIdentity->contentStreamId, - $contentRepository - ) - && ($renderCurrentDocumentMetadata === true - /* TODO: permissions || $this->nodeAuthorizationService->isGrantedToEditNode($node) === true */); - } - - private function isContentStreamOfLiveWorkspace( - ContentStreamId $contentStreamId, - ContentRepository $contentRepository - ): bool { - return $contentRepository->getWorkspaceFinder() - ->findOneByCurrentContentStreamId($contentStreamId) - ?->workspaceName->isLive() ?: false; - } } diff --git a/Neos.Neos/Classes/ViewHelpers/ContentElement/EditableViewHelper.php b/Neos.Neos/Classes/ViewHelpers/ContentElement/EditableViewHelper.php index 5be087be0f3..4f81f801571 100644 --- a/Neos.Neos/Classes/ViewHelpers/ContentElement/EditableViewHelper.php +++ b/Neos.Neos/Classes/ViewHelpers/ContentElement/EditableViewHelper.php @@ -20,6 +20,7 @@ use Neos\FluidAdaptor\Core\ViewHelper\AbstractTagBasedViewHelper; use Neos\FluidAdaptor\Core\ViewHelper\Exception as ViewHelperException; use Neos\Fusion\ViewHelpers\FusionContextTrait; +use Neos\Neos\Domain\Model\RenderingMode; use Neos\Neos\Service\ContentElementEditableService; /** @@ -114,7 +115,15 @@ public function render(): string } $this->tag->setContent($content); - return $this->contentElementEditableService->wrapContentProperty($node, $propertyName, (string)$this->tag->render()); + $output = (string)$this->tag->render(); + + /** @var RenderingMode $renderingMode */ + $renderingMode = $this->getContextVariable('renderingMode'); + if (!$renderingMode->isEdit) { + return $output; + } + + return $this->contentElementEditableService->wrapContentProperty($node, $propertyName, $output); } /** diff --git a/Neos.Neos/Classes/ViewHelpers/ContentElement/WrapViewHelper.php b/Neos.Neos/Classes/ViewHelpers/ContentElement/WrapViewHelper.php index d24056239e5..b7bca5eea1c 100644 --- a/Neos.Neos/Classes/ViewHelpers/ContentElement/WrapViewHelper.php +++ b/Neos.Neos/Classes/ViewHelpers/ContentElement/WrapViewHelper.php @@ -19,6 +19,7 @@ use Neos\FluidAdaptor\Core\ViewHelper\AbstractViewHelper; use Neos\FluidAdaptor\Core\ViewHelper\Exception as ViewHelperException; use Neos\Fusion\FusionObjects\Helpers\FusionAwareViewInterface; +use Neos\Neos\Domain\Model\RenderingMode; use Neos\Neos\Service\ContentElementWrappingService; /** @@ -85,6 +86,13 @@ public function render(): string 1645650713 ); } + + /** @var RenderingMode $renderingMode */ + $renderingMode = $fusionObject->getRuntime()->fusionGlobals->get('renderingMode'); + if (!$renderingMode->isEdit) { + return (string)$this->renderChildren(); + } + $currentContext = $fusionObject->getRuntime()->getCurrentContext(); $node = $this->arguments['node'] ?? $currentContext['node']; From 89a12ffc8ddb35b974ae0a7aa9ae0ce4bf36a221 Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Sun, 12 Nov 2023 11:15:32 +0100 Subject: [PATCH 2/5] BUGFIX: 2347 Uris in preview mode are not converted --- .../Classes/Fusion/ConvertUrisImplementation.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Neos.Neos/Classes/Fusion/ConvertUrisImplementation.php b/Neos.Neos/Classes/Fusion/ConvertUrisImplementation.php index 8e30786c1de..f7c93c09782 100644 --- a/Neos.Neos/Classes/Fusion/ConvertUrisImplementation.php +++ b/Neos.Neos/Classes/Fusion/ConvertUrisImplementation.php @@ -17,6 +17,7 @@ use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; use Neos\Flow\Log\Utility\LogEnvironment; use Neos\Flow\Mvc\Exception\NoMatchingRouteException; +use Neos\Neos\Domain\Model\RenderingMode; use Neos\Neos\FrontendRouting\NodeAddressFactory; use Neos\ContentRepository\Core\Projection\ContentGraph\Node; use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry; @@ -123,16 +124,18 @@ public function evaluate() ), 1382624087); } + /** @var RenderingMode $renderingMode */ + $renderingMode = $this->runtime->fusionGlobals->get('renderingMode'); + if ($renderingMode->isEdit && $this->fusionValue('forceConversion') !== true) { + return $text; + } + $contentRepository = $this->contentRepositoryRegistry->get( $node->subgraphIdentity->contentRepositoryId ); $nodeAddress = NodeAddressFactory::create($contentRepository)->createFromNode($node); - if (!$nodeAddress->isInLiveWorkspace() && !($this->fusionValue('forceConversion'))) { - return $text; - } - $unresolvedUris = []; $absolute = $this->fusionValue('absolute'); From e69b7e54534482cd225152e0c704bc9a68df01b2 Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Sun, 12 Nov 2023 11:18:14 +0100 Subject: [PATCH 3/5] TASK: Avoid magic `WorkspaceName::isLive()` --- Neos.Neos/Classes/Domain/Service/UserService.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Neos.Neos/Classes/Domain/Service/UserService.php b/Neos.Neos/Classes/Domain/Service/UserService.php index 6edd9b5332f..bab470d18b0 100644 --- a/Neos.Neos/Classes/Domain/Service/UserService.php +++ b/Neos.Neos/Classes/Domain/Service/UserService.php @@ -685,7 +685,7 @@ public function deactivateUser(User $user): void */ public function currentUserCanPublishToWorkspace(Workspace $workspace): bool { - if ($workspace->workspaceName->isLive()) { + if ($workspace->isPublicWorkspace()) { return $this->securityContext->hasRole('Neos.Neos:LivePublisher'); } @@ -709,7 +709,7 @@ public function currentUserCanPublishToWorkspace(Workspace $workspace): bool */ public function currentUserCanReadWorkspace(Workspace $workspace): bool { - if ($workspace->workspaceName->isLive() || $workspace->workspaceOwner === null) { + if ($workspace->isPublicWorkspace()) { return true; } From f8d289041fc3aebd9d62abb240ad00efa8df5847 Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Sun, 12 Nov 2023 20:07:39 +0100 Subject: [PATCH 4/5] TASK: Fix ConvertUris.feature by adding the correct renderingMode --- .../Features/Bootstrap/FusionTrait.php | 13 ++++++------- .../Features/Fusion/ConvertUris.feature | 18 +++++++++++++++++- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/Neos.Neos/Tests/Behavior/Features/Bootstrap/FusionTrait.php b/Neos.Neos/Tests/Behavior/Features/Bootstrap/FusionTrait.php index ea1d8a9b030..21b8f5ba725 100644 --- a/Neos.Neos/Tests/Behavior/Features/Bootstrap/FusionTrait.php +++ b/Neos.Neos/Tests/Behavior/Features/Bootstrap/FusionTrait.php @@ -12,7 +12,6 @@ */ use Behat\Gherkin\Node\PyStringNode; -use Behat\Gherkin\Node\TableNode; use Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindClosestNodeFilter; use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; use Neos\ContentRepository\TestSuite\Behavior\Features\Bootstrap\CRTestSuiteRuntimeVariables; @@ -24,9 +23,9 @@ use Neos\Fusion\Core\FusionSourceCodeCollection; use Neos\Fusion\Core\Parser; use Neos\Fusion\Core\RuntimeFactory; -use Neos\Neos\Domain\Model\RenderingMode; -use Neos\Neos\Domain\Service\NodeTypeNameFactory; use Neos\Fusion\Exception\RuntimeException; +use Neos\Neos\Domain\Service\NodeTypeNameFactory; +use Neos\Neos\Domain\Service\RenderingModeService; use PHPUnit\Framework\Assert; use Psr\Http\Message\ServerRequestFactoryInterface; @@ -68,12 +67,12 @@ public function setupFusionContext(): void } /** - * @When I am in Fusion rendering mode: + * @When the Fusion renderingMode is :requestUri */ - public function iAmInFusionRenderingMode(TableNode $renderingModeData): void + public function iAmInFusionRenderingMode(string $renderingModeName): void { - $data = $renderingModeData->getHash()[0]; - $this->fusionGlobalContext['renderingMode'] = new RenderingMode($data['name'] ?? 'Testing', strtolower($data['isEdit'] ?? 'false') === 'true', strtolower($data['isPreview'] ?? 'false') === 'true', $data['title'] ?? 'Testing', $data['fusionPath'] ?? 'root', []); + $renderingMode = $this->getObject(RenderingModeService::class)->findByName($renderingModeName); + $this->fusionGlobalContext['renderingMode'] = $renderingMode; } /** diff --git a/Neos.Neos/Tests/Behavior/Features/Fusion/ConvertUris.feature b/Neos.Neos/Tests/Behavior/Features/Fusion/ConvertUris.feature index 9d9661cc01e..8ed0e7184ca 100644 --- a/Neos.Neos/Tests/Behavior/Features/Fusion/ConvertUris.feature +++ b/Neos.Neos/Tests/Behavior/Features/Fusion/ConvertUris.feature @@ -55,7 +55,7 @@ Feature: Tests for the "Neos.Neos:ConvertUris" Fusion prototype """ And the Fusion context node is "a" And the Fusion context request URI is "http://localhost" - + And the Fusion renderingMode is "frontend" Scenario: Default output When I execute the following Fusion code: """fusion @@ -113,6 +113,22 @@ Feature: Tests for the "Neos.Neos:ConvertUris" Fusion prototype Some value with node URI: /a1. """ + Scenario: URI preserved in edit mode + Given the Fusion renderingMode is "inPlace" + When I execute the following Fusion code: + """fusion + include: resource://Neos.Fusion/Private/Fusion/Root.fusion + include: resource://Neos.Neos/Private/Fusion/Root.fusion + + test = Neos.Neos:ConvertUris { + value = 'Some value with node URI: node://a1.' + } + """ + Then I expect the following Fusion rendering result: + """ + Some value with node URI: node://a1. + """ + Scenario: Anchor tag without node or asset URI When I execute the following Fusion code: """fusion From faa72c7902c0386f54132d3b18cf2c6242405cde Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Fri, 17 Nov 2023 14:55:50 +0100 Subject: [PATCH 5/5] TASK: Use `assert` instead of `@var` annotation --- .../Classes/Fusion/ContentElementEditableImplementation.php | 2 +- .../Classes/Fusion/ContentElementWrappingImplementation.php | 2 +- Neos.Neos/Classes/Fusion/ConvertUrisImplementation.php | 2 +- .../Classes/Fusion/ExceptionHandlers/NodeWrappingHandler.php | 2 +- Neos.Neos/Classes/Fusion/ExceptionHandlers/PageHandler.php | 2 +- .../Classes/ViewHelpers/ContentElement/EditableViewHelper.php | 2 +- Neos.Neos/Classes/ViewHelpers/ContentElement/WrapViewHelper.php | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Neos.Neos/Classes/Fusion/ContentElementEditableImplementation.php b/Neos.Neos/Classes/Fusion/ContentElementEditableImplementation.php index 244031cb1d6..9e24293f650 100644 --- a/Neos.Neos/Classes/Fusion/ContentElementEditableImplementation.php +++ b/Neos.Neos/Classes/Fusion/ContentElementEditableImplementation.php @@ -57,8 +57,8 @@ public function evaluate() { $content = $this->getValue(); - /** @var RenderingMode $renderingMode */ $renderingMode = $this->runtime->fusionGlobals->get('renderingMode'); + assert($renderingMode instanceof RenderingMode); if (!$renderingMode->isEdit) { return $content; } diff --git a/Neos.Neos/Classes/Fusion/ContentElementWrappingImplementation.php b/Neos.Neos/Classes/Fusion/ContentElementWrappingImplementation.php index 8d2439a38dd..6e2b85fbc85 100644 --- a/Neos.Neos/Classes/Fusion/ContentElementWrappingImplementation.php +++ b/Neos.Neos/Classes/Fusion/ContentElementWrappingImplementation.php @@ -67,8 +67,8 @@ public function evaluate() { $content = $this->getValue(); - /** @var RenderingMode $renderingMode */ $renderingMode = $this->runtime->fusionGlobals->get('renderingMode'); + assert($renderingMode instanceof RenderingMode); if (!$renderingMode->isEdit) { return $content; } diff --git a/Neos.Neos/Classes/Fusion/ConvertUrisImplementation.php b/Neos.Neos/Classes/Fusion/ConvertUrisImplementation.php index f7c93c09782..151bf487fc4 100644 --- a/Neos.Neos/Classes/Fusion/ConvertUrisImplementation.php +++ b/Neos.Neos/Classes/Fusion/ConvertUrisImplementation.php @@ -124,8 +124,8 @@ public function evaluate() ), 1382624087); } - /** @var RenderingMode $renderingMode */ $renderingMode = $this->runtime->fusionGlobals->get('renderingMode'); + assert($renderingMode instanceof RenderingMode); if ($renderingMode->isEdit && $this->fusionValue('forceConversion') !== true) { return $text; } diff --git a/Neos.Neos/Classes/Fusion/ExceptionHandlers/NodeWrappingHandler.php b/Neos.Neos/Classes/Fusion/ExceptionHandlers/NodeWrappingHandler.php index 0cf8dc51b74..04123026c66 100644 --- a/Neos.Neos/Classes/Fusion/ExceptionHandlers/NodeWrappingHandler.php +++ b/Neos.Neos/Classes/Fusion/ExceptionHandlers/NodeWrappingHandler.php @@ -74,8 +74,8 @@ protected function handle($fusionPath, \Exception $exception, $referenceCode): s /** @var Node $node */ $node = $currentContext['node']; - /** @var RenderingMode $renderingMode */ $renderingMode = $this->runtime->fusionGlobals->get('renderingMode'); + assert($renderingMode instanceof RenderingMode); $applicationContext = $this->environment->getContext(); if (!$renderingMode->isEdit) { diff --git a/Neos.Neos/Classes/Fusion/ExceptionHandlers/PageHandler.php b/Neos.Neos/Classes/Fusion/ExceptionHandlers/PageHandler.php index ddcb58c53fe..fc72801df34 100644 --- a/Neos.Neos/Classes/Fusion/ExceptionHandlers/PageHandler.php +++ b/Neos.Neos/Classes/Fusion/ExceptionHandlers/PageHandler.php @@ -87,8 +87,8 @@ protected function handle($fusionPath, \Exception $exception, $referenceCode) } if (!is_null($documentNode)) { - /** @var RenderingMode $renderingMode */ $renderingMode = $this->runtime->fusionGlobals->get('renderingMode'); + assert($renderingMode instanceof RenderingMode); if ( $this->privilegeManager->isPrivilegeTargetGranted('Neos.Neos:Backend.GeneralAccess') && $renderingMode->isEdit diff --git a/Neos.Neos/Classes/ViewHelpers/ContentElement/EditableViewHelper.php b/Neos.Neos/Classes/ViewHelpers/ContentElement/EditableViewHelper.php index 4f81f801571..d6f77451288 100644 --- a/Neos.Neos/Classes/ViewHelpers/ContentElement/EditableViewHelper.php +++ b/Neos.Neos/Classes/ViewHelpers/ContentElement/EditableViewHelper.php @@ -117,8 +117,8 @@ public function render(): string $output = (string)$this->tag->render(); - /** @var RenderingMode $renderingMode */ $renderingMode = $this->getContextVariable('renderingMode'); + assert($renderingMode instanceof RenderingMode); if (!$renderingMode->isEdit) { return $output; } diff --git a/Neos.Neos/Classes/ViewHelpers/ContentElement/WrapViewHelper.php b/Neos.Neos/Classes/ViewHelpers/ContentElement/WrapViewHelper.php index b7bca5eea1c..dd19d456035 100644 --- a/Neos.Neos/Classes/ViewHelpers/ContentElement/WrapViewHelper.php +++ b/Neos.Neos/Classes/ViewHelpers/ContentElement/WrapViewHelper.php @@ -87,8 +87,8 @@ public function render(): string ); } - /** @var RenderingMode $renderingMode */ $renderingMode = $fusionObject->getRuntime()->fusionGlobals->get('renderingMode'); + assert($renderingMode instanceof RenderingMode); if (!$renderingMode->isEdit) { return (string)$this->renderChildren(); }