Skip to content

Commit

Permalink
FEATURE: Custom Route for node preview
Browse files Browse the repository at this point in the history
  • Loading branch information
bwaidelich committed Dec 2, 2019
1 parent 9c89319 commit aee183b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 8 additions & 1 deletion Classes/Controller/BackendController.php
Expand Up @@ -30,6 +30,7 @@
use Neos\Neos\Domain\Repository\SiteRepository;
use Neos\Neos\Domain\Service\ContentContext;
use Neos\Neos\Service\BackendRedirectionService;
use Neos\Neos\Service\LinkingService;
use Neos\Neos\Service\UserService;
use Neos\Neos\TypeConverter\NodeConverter;
use Neos\Neos\Ui\Domain\Service\StyleAndJavascriptInclusionService;
Expand Down Expand Up @@ -114,6 +115,12 @@ class BackendController extends ActionController
*/
protected $clipboard;

/**
* @Flow\Inject
* @var LinkingService
*/
protected $linkingService;

/**
* Initializes the view before invoking an action method.
*
Expand Down Expand Up @@ -187,7 +194,7 @@ public function redirectToAction(NodeInterface $node)
'no-cache',
'no-store'
]);
$this->redirect('show', 'Frontend\Node', 'Neos.Neos', ['node' => $node]);
$this->redirectToUri($this->linkingService->createNodeUri($this->controllerContext, $node));
}

/**
Expand Down
4 changes: 2 additions & 2 deletions Classes/Fusion/Helper/NodeInfoHelper.php
Expand Up @@ -186,8 +186,8 @@ protected function getUriInformation(NodeInterface $node, ControllerContext $con
}

try {
$nodeInfo['uri'] = $this->createRedirectToNode($controllerContext, $node);
} catch (\Neos\Flow\Mvc\Routing\Exception\MissingActionNameException $exception) {
$nodeInfo['uri'] = $this->uri($node, $controllerContext);
} catch (\Neos\Neos\Exception $exception) {
// Unless there is a serious problem with routes there shouldn't be an exception ever.
$nodeInfo['uri'] = '';
}
Expand Down

0 comments on commit aee183b

Please sign in to comment.