From 9b5e34c6a3493e1075202d9c4534f1dfc9ee62e4 Mon Sep 17 00:00:00 2001 From: Karsten Dambekalns Date: Wed, 1 Nov 2023 11:18:14 +0100 Subject: [PATCH 1/3] !!! TASK: Adjust to Neos 9.0 --- Classes/Controller/PageController.php | 6 +++--- composer.json | 11 ++++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Classes/Controller/PageController.php b/Classes/Controller/PageController.php index e5430c4..1fa7f73 100644 --- a/Classes/Controller/PageController.php +++ b/Classes/Controller/PageController.php @@ -14,7 +14,7 @@ * source code. */ -use Neos\ContentRepository\Domain\Model\NodeInterface; +use Neos\ContentRepository\Core\Projection\ContentGraph\Node; use Neos\Flow\Mvc\Controller\ActionController; use Neos\Flow\Mvc\Exception\StopActionException; use Neos\Neos\Controller\Frontend\NodeController; @@ -25,10 +25,10 @@ class PageController extends ActionController /** * Redirects request to the given node in preview mode without the neos backend * - * @param NodeInterface $node + * @param Node $node * @throws StopActionException */ - public function renderPreviewPageAction(NodeInterface $node): void + public function renderPreviewPageAction(Node $node): void { $previewAction = 'preview'; diff --git a/composer.json b/composer.json index a1a7b45..87f1d32 100644 --- a/composer.json +++ b/composer.json @@ -23,11 +23,12 @@ ], "homepage": "https://yoast.com", "require": { - "php": ">=7.4", - "neos/neos": "^7.3 || ^8.3", - "neos/neos-ui": "^7.3 || ^8.3", - "neos/seo": "~3.0", - "ext-json": "*" + "php": "^8.2", + "ext-json": "*", + + "neos/neos": "^9.0", + "neos/neos-ui": "^9.0", + "neos/seo": "~4.1" }, "replace": { "shel/neos-yoast-seo": "self.version" From 902476e4df637127f54766d91033c29699fe1055 Mon Sep 17 00:00:00 2001 From: Karsten Dambekalns Date: Wed, 1 Nov 2023 11:18:36 +0100 Subject: [PATCH 2/3] TASK: Drop special case handling for Neos 4 --- Classes/Controller/PageController.php | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/Classes/Controller/PageController.php b/Classes/Controller/PageController.php index 1fa7f73..de0a0f1 100644 --- a/Classes/Controller/PageController.php +++ b/Classes/Controller/PageController.php @@ -17,7 +17,6 @@ use Neos\ContentRepository\Core\Projection\ContentGraph\Node; use Neos\Flow\Mvc\Controller\ActionController; use Neos\Flow\Mvc\Exception\StopActionException; -use Neos\Neos\Controller\Frontend\NodeController; class PageController extends ActionController { @@ -30,17 +29,7 @@ class PageController extends ActionController */ public function renderPreviewPageAction(Node $node): void { - $previewAction = 'preview'; - - # Neos 5.x uses the 'preview' action which also sets cache headers - # So for Neos 4.x we have to add the cache headers and use the 'show' action - if (!method_exists(NodeController::class, 'previewAction')) { - $previewAction = 'show'; - /** @noinspection PhpUndefinedMethodInspection */ - $this->response->getHeaders()->setCacheControlDirective('no-cache, no-store, must-revalidate'); - } - - $this->forward($previewAction, 'Frontend\Node', 'Neos.Neos', [ + $this->forward('preview', 'Frontend\Node', 'Neos.Neos', [ 'node' => $node, 'yoastSeoPreviewMode' => true, ]); From 50a50892bb635ae4b122bca0ce7dffdcbb0d4d4c Mon Sep 17 00:00:00 2001 From: Karsten Dambekalns Date: Tue, 14 May 2024 15:54:51 +0200 Subject: [PATCH 3/3] TASK: Fusion code cleanup via `neos/rector` --- Resources/Private/Fusion/Components/Application.fusion | 8 ++++---- Resources/Private/Fusion/Documents/YoastSeoView.fusion | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Resources/Private/Fusion/Components/Application.fusion b/Resources/Private/Fusion/Components/Application.fusion index 6d5527e..8d7785b 100644 --- a/Resources/Private/Fusion/Components/Application.fusion +++ b/Resources/Private/Fusion/Components/Application.fusion @@ -2,7 +2,7 @@ prototype(Yoast.YoastSeoForNeos:Component.Application) < prototype(Neos.Fusion:T attributes { class = 'yoast-seo__application' id = 'yoast-app' - data-configuration = Neos.Fusion:RawArray { + data-configuration = Neos.Fusion:DataStructure { title = ${q(documentNode).property('title')} titleOverride = ${q(documentNode).property('titleOverride')} description = ${q(documentNode).property('metaDescription')} @@ -17,7 +17,7 @@ prototype(Yoast.YoastSeoForNeos:Component.Application) < prototype(Neos.Fusion:T workerUrl = Neos.Fusion:ResourceUri { path = 'resource://Yoast.YoastSeoForNeos/Public/Assets/webWorker.js' } - previewUrl = ${'/neosyoastseo/page/renderPreviewPage?node=' + String.rawUrlEncode(documentNode.contextPath)} + previewUrl = ${'/neosyoastseo/page/renderPreviewPage?node=' + String.rawUrlEncode(Neos.Node.serializedNodeAddress(documentNode))} baseUrl = Yoast.YoastSeoForNeos:BaseUri siteUrl = Neos.Neos:NodeUri { node = ${q(site).context({workspaceName: 'live'}).get(0)} @@ -30,8 +30,8 @@ prototype(Yoast.YoastSeoForNeos:Component.Application) < prototype(Neos.Fusion:T // Default url to check for the favicon if not set as link tag in the html head with `rel="shortcut icon"` or `rel="icon"`. faviconSrc = ${this.siteUrl + '/favicon.ico'} - breadcrumbs = Neos.Fusion:RawCollection { - collection = ${Array.reverse(q(documentNode).parents('[instanceof Neos.Neos:Document]').get())} + breadcrumbs = Neos.Fusion:Map { + items = ${Array.reverse(q(documentNode).parents('[instanceof Neos.Neos:Document]').get())} itemRenderer = ${q(item).property('uriPathSegment')} } diff --git a/Resources/Private/Fusion/Documents/YoastSeoView.fusion b/Resources/Private/Fusion/Documents/YoastSeoView.fusion index 06bb13f..270cf90 100644 --- a/Resources/Private/Fusion/Documents/YoastSeoView.fusion +++ b/Resources/Private/Fusion/Documents/YoastSeoView.fusion @@ -4,7 +4,7 @@ prototype(Yoast.YoastSeoForNeos:Documents.YoastSeoView) < prototype(Neos.Neos:Pa head { stylesheets > - stylesheets = Neos.Fusion:Array { + stylesheets = Neos.Fusion:Join { main = afx` @@ -21,7 +21,7 @@ prototype(Yoast.YoastSeoForNeos:Documents.YoastSeoView) < prototype(Neos.Neos:Pa node = ${node} site = ${site} - renderer = Neos.Fusion:Array { + renderer = Neos.Fusion:Join { appWrapper = afx`