Neos\Neos\Domain\Service\ContentContext::getCurrentSiteNode PHP Method

getCurrentSiteNode() public method

Returns the node of the current site.
public getCurrentSiteNode ( ) : Neos\ContentRepository\Domain\Model\NodeInterface
return Neos\ContentRepository\Domain\Model\NodeInterface
    public function getCurrentSiteNode()
    {
        if ($this->currentSite !== null && $this->currentSiteNode === null) {
            $siteNodePath = NodePaths::addNodePathSegment(SiteService::SITES_ROOT_PATH, $this->currentSite->getNodeName());
            $this->currentSiteNode = $this->getNode($siteNodePath);
            if (!$this->currentSiteNode instanceof NodeInterface) {
                $this->systemLogger->log(sprintf('Warning: %s::getCurrentSiteNode() couldn\'t load the site node for path "%s" in workspace "%s". This is probably due to a missing baseworkspace for the workspace of the current user.', __CLASS__, $siteNodePath, $this->workspaceName), LOG_WARNING);
            }
        }
        return $this->currentSiteNode;
    }

Usage Example

 /**
  * @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'));
 }
All Usage Examples Of Neos\Neos\Domain\Service\ContentContext::getCurrentSiteNode