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

!!! FEATURE: Add Neos.Neos:Site (singular) NodeType for site nodes #4531

Closed
mhsdesign opened this issue Sep 19, 2023 · 7 comments · Fixed by #4563
Closed

!!! FEATURE: Add Neos.Neos:Site (singular) NodeType for site nodes #4531

mhsdesign opened this issue Sep 19, 2023 · 7 comments · Fixed by #4563

Comments

@mhsdesign
Copy link
Member

mhsdesign commented Sep 19, 2023

upgrade instructions -> #5400

@nezaniel suggested in slack

What do you think of introducing the Document type "Neos.Neos:Site" (singular) for site nodes? Should make stuff a lot easier (think of "find current site node" or "decide whether this should have an uriPathSegment"). It's breaky because Projects already on 9.0 need to adjust their NodeTypes config, but it's just one line per site type.

(this got actually 7 thumbs up :D)

and @kitsunet answered with

makes sense to me, maybe even :SiteRoot to make it even clearer it's that single root per site?


Our current way of fetching the sideNode is really not ideal or fast:

public function findSiteNode(Node $node): Node
{
$previousNode = null;
$subgraph = $this->contentRepositoryRegistry->subgraphForNode($node);
do {
if ($node->nodeType->isOfType('Neos.Neos:Sites')) {
// the Site node is the one one level underneath the "Sites" node.
if (is_null($previousNode)) {
break;
}
return $previousNode;
}
$previousNode = $node;
} while ($node = $subgraph->findParentNode($node->nodeAggregateId));
// no Site node found at rootline
throw new \RuntimeException('No site node found!');
}

@nezaniel then i guess it would make sense to leverage #4519 findClosestNode to write:

$siteNode =  $subgraph->findClosestNode($node->nodeAggregateId, FindClosestNodeFilter::create(nodeTypeConstraints: 'Neos.Neos:Site');
@bwaidelich bwaidelich moved this to Prioritized 🔥 in Neos 9.0 Release Board Sep 19, 2023
@bwaidelich bwaidelich changed the title TASK: Add Neos.Neos:Site (singular) NodeType for site nodes FEATURE: Add Neos.Neos:Site (singular) NodeType for site nodes Sep 19, 2023
@mhsdesign
Copy link
Member Author

mhsdesign commented Sep 19, 2023

The site:create must then expect the Neos.Neos:Site type as homepage node

Or better the Neos.Neos:Sites should declare the constraint to only Neos.Neos:Site

And the Neos.Neos:Document must declare a constraint to not allow Neos.Neos:Site -> never!

@mhsdesign
Copy link
Member Author

\Neos\Neos\Domain\Service\NodeSiteResolvingService::findSiteNodeForNodeAddress and \Neos\Neos\Domain\Service\SiteNodeUtility::findSiteNode

should be refactored to use

$siteNode = $subgraph->findClosestNode($node->nodeAggregateId, FindClosestNodeFilter::create(nodeTypeConstraints: 'Neos.Neos:Site');

@mhsdesign mhsdesign moved this from Prioritized 🔥 to Under Review 👀 in Neos 9.0 Release Board Sep 26, 2023
@mhsdesign mhsdesign changed the title FEATURE: Add Neos.Neos:Site (singular) NodeType for site nodes !!! FEATURE: Add Neos.Neos:Site (singular) NodeType for site nodes Sep 26, 2023
@ahaeslich
Copy link
Member

ahaeslich commented Sep 27, 2023

@mhsdesign you already mentoined

The site:create must then expect the Neos.Neos:Site type as homepage node

And don't we also have to adjust the legacy data migration? Do we expect users to migrate the old data and change the root node type configuration afterwards? Or do we inform them about the needed adjustments?

@mhsdesign
Copy link
Member Author

mhsdesign commented Sep 27, 2023

Yes i was thinking about this too. Now the legacy migration service asserts that the site node must be of type Neos.Neos:Site.

@mhsdesign
Copy link
Member Author

Existing projects might crash while rendering the site (as we expect the siteNode to be of type Site)

but structure adjustments should find the issue:

./flow structureadjustments:detect

The parent node type "Neos.Neos:Sites" is not allowing children of type "Neos.Demo:Document.Homepage",
                        and the grandparent node type "" is not allowing grandchildren of type "Neos.Demo:Document.Homepage".
                        Thus, the node is invalid at this location and should be removed.

this is ofcourse not ideal and we just need to inform everyone to add this new super type to the homepage - i do hope they have a separate nodeType for that already 🤞

@dlubitz
Copy link
Contributor

dlubitz commented Sep 29, 2023

i do hope they have a separate nodeType for that already

Most on my projects don't have that 🤷‍♂️

@mhsdesign
Copy link
Member Author

mhsdesign commented Sep 29, 2023

Most on my projects don't have that 🤷‍♂️

okay i see this is definitely a case we need to take care of. Lets move the migration discussion over here:

#5400

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants