/** * Finds the node in the current breadcrumb path between current site node and * current node whose level matches the specified entry level. * * @param integer $givenSiteLevel The site level child nodes of the to be found parent node should have. See $this->entryLevel for possible values. * @param \TYPO3\TYPO3\Domain\Service\ContentContext $contentContext * @return \TYPO3\TYPO3CR\Domain\Model\NodeInterface The parent node of the node at the specified level or NULL if none was found */ private function findParentNodeInBreadcrumbPathByLevel($givenSiteLevel, \TYPO3\TYPO3\Domain\Service\ContentContext $contentContext) { $parentNode = NULL; $breadcrumbNodes = $contentContext->getNodesOnPath($contentContext->getCurrentSiteNode(), $contentContext->getCurrentNode()); if ($givenSiteLevel > 0 && isset($breadcrumbNodes[$givenSiteLevel - 1])) { $parentNode = $breadcrumbNodes[$givenSiteLevel - 1]; } elseif ($givenSiteLevel <= 0) { $currentSiteLevel = count($breadcrumbNodes) - 1; if ($currentSiteLevel + $givenSiteLevel < 1) { $parentNode = $breadcrumbNodes[0]; } else { $parentNode = $breadcrumbNodes[$currentSiteLevel + $givenSiteLevel - 1]; } } return $parentNode; }