protected function findParentNodeInBreadcrumbPathByLevel($givenSiteLevel, NodeInterface $startingPoint)
{
$parentNode = null;
if ($givenSiteLevel === 0) {
return $startingPoint;
}
$absoluteDepth = $this->calculateNodeDepthFromRelativeLevel($givenSiteLevel, $startingPoint);
if ($absoluteDepth - 1 > $this->getNodeLevelInSite($startingPoint)) {
return null;
}
$currentSiteNode = $this->currentNode->getContext()->getCurrentSiteNode();
$breadcrumbNodes = $currentSiteNode->getContext()->getNodesOnPath($currentSiteNode, $startingPoint);
if (isset($breadcrumbNodes[$absoluteDepth - 1])) {
$parentNode = $breadcrumbNodes[$absoluteDepth - 1];
}
return $parentNode;
}