Skip to content

Commit

Permalink
TASK: Make linter happy
Browse files Browse the repository at this point in the history
  • Loading branch information
mficzel committed May 24, 2023
1 parent da5a085 commit c4fa795
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function findDefault(): EditPreviewMode

public function findByName(string $name): EditPreviewMode
{
if (array_key_exists($name,$this->editPreviewModeConfigurations)) {
if (array_key_exists($name, $this->editPreviewModeConfigurations)) {
return EditPreviewMode::fromNameAndConfiguration($name, $this->editPreviewModeConfigurations[$name]);
}
throw new InvalidEditPreviewModeException(sprintf('"%s" is not a valid editPreviewMode', $name), 1683790077);
Expand Down
9 changes: 6 additions & 3 deletions Neos.Neos/Classes/FrontendRouting/NodeUriBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,16 @@ public function uriFor(NodeAddress $nodeAddress): UriInterface
{
if (!$nodeAddress->isInLiveWorkspace()) {
$request = $this->uriBuilder->getRequest();
if ($request->getControllerPackageKey() === 'Neos.Neos'
if (
$request->getControllerPackageKey() === 'Neos.Neos'
&& $request->getControllerName() === "Frontend\Node"
) {
if ($request->getControllerActionName() == 'edit') {
return $this->editUriFor($nodeAddress, $request->hasArgument('editPreviewMode') ? $request->getArgument('editPreviewMode') : null);
$editPreviewModeArgument = $request->hasArgument('editPreviewMode') ? $request->getArgument('editPreviewMode') : null;
return $this->editUriFor($nodeAddress, is_string($editPreviewModeArgument) ? $editPreviewModeArgument : null);
} elseif ($request->getControllerActionName() == 'preview') {
return $this->previewUriFor($nodeAddress, $request->hasArgument('editPreviewMode') ? $request->getArgument('editPreviewMode') : null);
$editPreviewModeArgument = $request->hasArgument('editPreviewMode') ? $request->getArgument('editPreviewMode') : null;
return $this->previewUriFor($nodeAddress, is_string($editPreviewModeArgument) ? $editPreviewModeArgument : null);
}
}

Expand Down
13 changes: 9 additions & 4 deletions Neos.Neos/Classes/Fusion/Helper/BackendHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,20 @@ public function isPreviewMode(ActionRequest $request): bool
);
}

public function editPreviewModeCacheIdentifier(ActionRequest $request): string
public function renderingModeCacheIdentifier(ActionRequest $request): string
{
if ($request->getControllerPackageKey() === 'Neos.Neos'
if (
$request->getControllerPackageKey() === 'Neos.Neos'
&& $request->getControllerName() === "Frontend\Node"
&& ($request->getControllerActionName() === 'edit' || $request->getControllerActionName() === 'preview')
) {
return $request->getControllerActionName() . ($request->hasArgument('editPreviewMode') ? ':' . $request->getArgument('editPreviewMode') : '');
$editPreviewModeArgument = $request->hasArgument('editPreviewMode') ? $request->getArgument('editPreviewMode') : null;
if (is_string($editPreviewModeArgument)) {
return $request->getControllerActionName() . ':' . $editPreviewModeArgument;
}
return $request->getControllerActionName();
} else {
return "";
return "show";
}
}

Expand Down
5 changes: 3 additions & 2 deletions Neos.Neos/Classes/Service/LinkingService.php
Original file line number Diff line number Diff line change
Expand Up @@ -370,12 +370,13 @@ public function createNodeUri(
$uriBuilder = clone $controllerContext->getUriBuilder();
$uriBuilder->setRequest($request);

if ($request->getControllerPackageKey() === 'Neos.Neos'
if (
$request->getControllerPackageKey() === 'Neos.Neos'
&& $request->getControllerName() === "Frontend\Node"
&& in_array($request->getControllerActionName(), ['edit', 'preview'])
) {
$action = $request->getControllerActionName();
if ( $request->hasArgument('editPreviewMode')) {
if ($request->hasArgument('editPreviewMode')) {
$arguments['editPreviewMode'] = $request->getArgument('editPreviewMode');
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
prototype(Neos.Fusion:GlobalCacheIdentifiers) {
workspaceChain = ${Array.join(Array.keys(Neos.Caching.getWorkspaceChain(documentNode)), ',')}
[email protected] = ${!!documentNode}
editPreviewMode = ${Neos.Backend.editPreviewModeCacheIdentifier(request)}
renderingMode = ${Neos.Backend.renderingModeCacheIdentifier(request)}
}

0 comments on commit c4fa795

Please sign in to comment.