Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TASK: Provide Neos 9.0 compatibility #100

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 4 additions & 15 deletions Classes/Controller/PageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,22 @@
* 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;

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';

# 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,
]);
Expand Down
8 changes: 4 additions & 4 deletions Resources/Private/Fusion/Components/Application.fusion
Original file line number Diff line number Diff line change
Expand Up @@ -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')}
Expand All @@ -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)}
Expand All @@ -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')}
}

Expand Down
4 changes: 2 additions & 2 deletions Resources/Private/Fusion/Documents/YoastSeoView.fusion
Original file line number Diff line number Diff line change
Expand Up @@ -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`
<link rel="stylesheet" type="text/css">
<Neos.Fusion:ResourceUri @path="attributes.href" path="resource://Yoast.YoastSeoForNeos/Public/Assets/main.css"/>
Expand All @@ -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`
<main class="yoast-seo__container" @key="appWrapper">
<Yoast.YoastSeoForNeos:Component.Header/>
Expand Down
11 changes: 6 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading