protected getRelativeNodePathByUriPathSegmentProperties ( Neos\ContentRepository\Domain\Model\NodeInterface $siteNode, string $relativeRequestPath ) : string | ||
$siteNode | Neos\ContentRepository\Domain\Model\NodeInterface | The site node, used as a starting point while traversing the tree |
$relativeRequestPath | string | The request path, relative to the site's root path |
return | string |
protected function getRelativeNodePathByUriPathSegmentProperties(NodeInterface $siteNode, $relativeRequestPath)
{
$relativeNodePathSegments = [];
$node = $siteNode;
foreach (explode('/', $relativeRequestPath) as $pathSegment) {
$foundNodeInThisSegment = false;
foreach ($node->getChildNodes('Neos.Neos:Document') as $node) {
/** @var NodeInterface $node */
if ($node->getProperty('uriPathSegment') === $pathSegment) {
$relativeNodePathSegments[] = $node->getName();
$foundNodeInThisSegment = true;
break;
}
}
if (!$foundNodeInThisSegment) {
return false;
}
}
return implode('/', $relativeNodePathSegments);
}