From e93b7d9366b36887175b79ce58909afa1f181407 Mon Sep 17 00:00:00 2001 From: Nguonchay Date: Thu, 2 Aug 2018 15:52:26 +0700 Subject: [PATCH] [TASK] Support multiple languages for policy node --- Classes/Eel/Helper/LinkBuildingHelper.php | 70 ----------------------- Resources/Private/Fusion/Root.fusion | 7 ++- 2 files changed, 6 insertions(+), 71 deletions(-) delete mode 100644 Classes/Eel/Helper/LinkBuildingHelper.php diff --git a/Classes/Eel/Helper/LinkBuildingHelper.php b/Classes/Eel/Helper/LinkBuildingHelper.php deleted file mode 100644 index 2353e6c..0000000 --- a/Classes/Eel/Helper/LinkBuildingHelper.php +++ /dev/null @@ -1,70 +0,0 @@ - - */ -class LinkBuildingHelper implements ProtectedContextAwareInterface -{ - - /** - * @Flow\Inject - * @var ContextFactoryInterface - */ - protected $contextFactory; - - - /** - * @Flow\Inject - * @var UriBuilder - */ - protected $uriBuilder; - - - /** - * @param string $nodeIdentifier - * @param string $workspace - * @return string - * @throws \Neos\Flow\Mvc\Routing\Exception\MissingActionNameException - */ - public function fromNodeIdentifier(string $nodeIdentifier, string $workspace = 'live'): string - { - $context = $this->contextFactory->create(['workspace' => $workspace]); - $node = $context->getNodeByIdentifier($nodeIdentifier); - - //End here, if node does not exist - if (!$node instanceof NodeInterface) { - return ''; - } - - $httpRequest = Request::createFromEnvironment(); - $actionRequest = new ActionRequest($httpRequest); - $this->uriBuilder->setRequest($actionRequest); - - return $this->uriBuilder - ->reset() - ->setCreateAbsoluteUri(true) - ->uriFor('show', ['node' => $node], 'Frontend\Node', 'Neos.Neos'); - } - - public function allowsCallOfMethod($methodName) - { - return true; - } - -} diff --git a/Resources/Private/Fusion/Root.fusion b/Resources/Private/Fusion/Root.fusion index 072c3ce..d960d34 100644 --- a/Resources/Private/Fusion/Root.fusion +++ b/Resources/Private/Fusion/Root.fusion @@ -19,7 +19,12 @@ prototype(Neos.Neos:Page) { deny = ${Translation.translate('deny', null, [], Configuration.setting('KaufmannDigital.CookieConsent.translations.source'), Configuration.setting('KaufmannDigital.CookieConsent.translations.package'))} link = ${Translation.translate('link-text', null, [], Configuration.setting('KaufmannDigital.CookieConsent.translations.source'), Configuration.setting('KaufmannDigital.CookieConsent.translations.package'))} - href = ${LinkBuilder.fromNodeIdentifier(Configuration.setting('KaufmannDigital.CookieConsent.policyPageNode'))} + href = NodeUri { + node = ${q(site).find('#' + Configuration.setting('KaufmannDigital.CookieConsent.policyPageNode')).get(0)} + absolute = true + + @if.isset = ${String.isBlank(Configuration.setting('KaufmannDigital.CookieConsent.policyPageNode')) == false} + } } @process.json = ${Json.stringify(value)}