From 91b3a9c88dff5a63c44530e4f5b6aca7cfbee8b8 Mon Sep 17 00:00:00 2001 From: Stefan Bruggmann Date: Wed, 27 Mar 2024 07:00:34 +0100 Subject: [PATCH] check rendering mode and hide hidden nodes to fix #41 --- Classes/Aspects/NodeConverterAspect.php | 54 +++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 Classes/Aspects/NodeConverterAspect.php diff --git a/Classes/Aspects/NodeConverterAspect.php b/Classes/Aspects/NodeConverterAspect.php new file mode 100644 index 0000000..d91ba98 --- /dev/null +++ b/Classes/Aspects/NodeConverterAspect.php @@ -0,0 +1,54 @@ +prepareContextProperties())") + * @param \Neos\Flow\Aop\JoinPointInterface $joinPoint The current join point + * @return array + */ + public function suppressInvisibleContentShown(JoinPointInterface $joinPoint) + { + $contextProperties = $joinPoint->getAdviceChain()->proceed($joinPoint); + $workspaceName = $joinPoint->getMethodArgument('workspaceName'); + + try { + if ( + $workspaceName !== 'live' + && ( + $this->userInterfaceModeService->findModeByCurrentUser()->isPreview() + || $this->securityContext->hasRole('Flownative.WorkspacePreview:WorkspacePreviewer') + ) + ) { + $contextProperties['invisibleContentShown'] = false; + } + } catch (\Neos\Flow\Security\Exception\NoSuchRoleException|\Neos\Flow\Security\Exception $e) { + // ignore + } + + return $contextProperties; + } +}