public findDefault ( ) : |
||
Résultat |
public function findDefault()
{
if ($this->defaultSiteNodeName === null) {
return $this->findOnline()->getFirst();
}
/**
* @var Site $defaultSite
*/
$defaultSite = $this->findOneByNodeName($this->defaultSiteNodeName);
if (!$defaultSite instanceof Site || $defaultSite->getState() !== Site::STATE_ONLINE) {
throw new NeosException(sprintf('DefaultSiteNode %s not found or not active', $this->defaultSiteNodeName), 1476374818);
}
return $defaultSite;
}
/** * Determines the current domain and site from the request and sets the resulting values as * as defaults. * * @param array $defaultContextProperties * @return array */ protected function setDefaultSiteAndDomainFromCurrentRequest(array $defaultContextProperties) { $currentDomain = $this->domainRepository->findOneByActiveRequest(); if ($currentDomain !== null) { $defaultContextProperties['currentSite'] = $currentDomain->getSite(); $defaultContextProperties['currentDomain'] = $currentDomain; } else { $defaultContextProperties['currentSite'] = $this->siteRepository->findDefault(); } return $defaultContextProperties; }