Returns the node of the current site.
public getCurrentSiteNode ( ) : Neos\ContentRepository\Domain\Model\NodeInterface | ||
return | Neos\ContentRepository\Domain\Model\NodeInterface |
/** * @test */ public function viewHelperRendersUriViaStringPointingToSubNodes() { $this->tsRuntime->pushContext('documentNode', $this->contentContext->getCurrentSiteNode()->getNode('home/about-us/mission')); $this->assertOutputLinkValid('en/home/about-us/history.html', $this->viewHelper->render('../history')); $this->tsRuntime->popContext(); $this->assertOutputLinkValid('en/home/about-us/our-mission.html', $this->viewHelper->render('about-us/mission')); $this->assertOutputLinkValid('en/home/about-us/our-mission.html', $this->viewHelper->render('./about-us/mission')); }
/** * @test */ public function viewHelperRendersUriViaStringPointingToSubNodes() { $this->tsRuntime->pushContext('documentNode', $this->contentContext->getCurrentSiteNode()->getNode('home/about-us/mission')); $this->assertSame('<a href="/en/home/about-us/history.html">History</a>', $this->viewHelper->render('../history')); $this->tsRuntime->popContext(); $this->assertSame('<a href="/en/home/about-us/our-mission.html">Our mission</a>', $this->viewHelper->render('about-us/mission')); $this->assertSame('<a href="/en/home/about-us/our-mission.html">Our mission</a>', $this->viewHelper->render('./about-us/mission')); }
/** * Find all nodes of a specific node type * * @param array $nodeTypes * @param ContentContext $context current content context, see class doc comment for details * @return array<NodeInterface> all nodes of type $nodeType in the current $context */ protected function getNodes(array $nodeTypes, ContentContext $context) { $nodes = []; $siteNode = $context->getCurrentSiteNode(); foreach ($this->nodeDataRepository->findByParentAndNodeTypeRecursively($siteNode->getPath(), implode(',', $nodeTypes), $context->getWorkspace()) as $nodeData) { $nodes[] = $this->nodeFactory->createFromNodeData($nodeData, $context); } return $nodes; }