Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Bastian Waidelich <b.waidelich@wwwision.de>
Co-authored-by: Marc Henry Schultz <85400359+mhsdesign@users.noreply.github.com>
  • Loading branch information
3 people authored Jun 19, 2023
1 parent dcc9d3d commit c7b22ec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
16 changes: 6 additions & 10 deletions Neos.Neos/Classes/Fusion/Helper/BackendHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,29 +41,25 @@ public function interfaceLanguage(): string
return $this->userService->getInterfaceLanguage();
}

public function isEditMode(ActionRequest $request): bool
public static function isEditMode(ActionRequest $request): bool
{
return ($request->getControllerPackageKey() === 'Neos.Neos'
&& $request->getControllerName() === "Frontend\Node"
&& $request->getControllerName() === 'Frontend\\Node'
&& $request->getControllerActionName() === 'edit'
);
}

public function isPreviewMode(ActionRequest $request): bool
public static function isPreviewMode(ActionRequest $request): bool
{
return ($request->getControllerPackageKey() === 'Neos.Neos'
&& $request->getControllerName() === "Frontend\Node"
&& $request->getControllerName() === 'Frontend\\Node'
&& $request->getControllerActionName() === 'preview'
);
}

public function renderingModeCacheIdentifier(ActionRequest $request): string
public static function renderingModeCacheIdentifier(ActionRequest $request): string
{
if (
$request->getControllerPackageKey() === 'Neos.Neos'
&& $request->getControllerName() === "Frontend\Node"
&& ($request->getControllerActionName() === 'edit' || $request->getControllerActionName() === 'preview')
) {
if ($this->isEditMode($request) || $this->isPreviewMode($request)) {
$editPreviewModeArgument = $request->hasArgument('editPreviewMode') ? $request->getArgument('editPreviewMode') : null;
if (is_string($editPreviewModeArgument)) {
return $request->getControllerActionName() . ':' . $editPreviewModeArgument;
Expand Down
6 changes: 1 addition & 5 deletions Neos.Neos/Classes/Service/LinkingService.php
Original file line number Diff line number Diff line change
Expand Up @@ -370,11 +370,7 @@ public function createNodeUri(
$uriBuilder = clone $controllerContext->getUriBuilder();
$uriBuilder->setRequest($request);

if (
$request->getControllerPackageKey() === 'Neos.Neos'
&& $request->getControllerName() === "Frontend\Node"
&& in_array($request->getControllerActionName(), ['edit', 'preview'])
) {
if (BackendHelper::isEditMode($request) || BackendHelper::isPreviewMode($request)) {
$action = $request->getControllerActionName();
if ($request->hasArgument('editPreviewMode')) {
$arguments['editPreviewMode'] = $request->getArgument('editPreviewMode');
Expand Down

0 comments on commit c7b22ec

Please sign in to comment.