Neos\Neos\Routing\FrontendNodeRoutePartHandler::getRelativeNodePathByUriPathSegmentProperties PHP Method

getRelativeNodePathByUriPathSegmentProperties() protected method

This method traverses the segments of the given request path and tries to find nodes on the current level which have a matching "uriPathSegment" property. If no node could be found which would match the given request path, false is returned.
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);
    }