Neos.Neos/Classes/Controller/Backend/MenuHelper.php
public function buildSiteList(ControllerContext $controllerContext)
    {
        $requestUriHost = $controllerContext->getRequest()->getHttpRequest()->getUri()->getHost();

        $domainsFound = false;
        $sites = [];
        foreach ($this->siteRepository->findOnline() as $site) {
            $uri = null;
            $active = false;
            /** @var $site Site */
            if ($site->hasActiveDomains()) {
                $activeHostPatterns = $site->getActiveDomains()->map(function ($domain) {
                    return $domain->getHostname();
                })->toArray();
                $active = in_array($requestUriHost, $activeHostPatterns, true);
                if ($active) {
                    $uri = $controllerContext->getUriBuilder()
                        ->reset()
                        ->setCreateAbsoluteUri(true)
                        ->uriFor('index', [], 'Backend\Backend', 'Neos.Neos');
                } else {
                    $uri = $controllerContext->getUriBuilder()
                        ->reset()
                        ->uriFor('switchSite', ['site' => $site], 'Backend\Backend', 'Neos.Neos');
                }
                $domainsFound = true;
            }

            $sites[] = [
                'name' => $site->getName(),
                'nodeName' => $site->getNodeName(),
                'uri' => $uri,
                'active' => $active
            ];
        }

        if ($domainsFound === false) {
            $uri = $controllerContext->getUriBuilder()
                ->reset()
                ->setCreateAbsoluteUri(true)
                ->uriFor('index', [], 'Backend\Backend', 'Neos.Neos');
            $sites[0]['uri'] = $uri;
        }

        return $sites;
    }
public function buildSiteList(ControllerContext $controllerContext)
    {
        $requestUriHost = $controllerContext->getRequest()->getHttpRequest()->getUri()->getHost();

        $domainsFound = false;
        $sites = [];
        foreach ($this->siteRepository->findOnline() as $site) {
            $uri = null;
            $active = false;
            /** @var $site Site */
            if ($site->hasActiveDomains()) {
                $activeHostPatterns = $site->getActiveDomains()->map(function ($domain) {
                    return $domain->getHostname();
                })->toArray();
                $active = in_array($requestUriHost, $activeHostPatterns, true);
                if ($active) {
                    $uri = $controllerContext->getUriBuilder()
                        ->reset()
                        ->setCreateAbsoluteUri(true)
                        ->uriFor('index', [], 'Backend\Backend', 'Neos.Neos');
                } else {
                    $uri = $controllerContext->getUriBuilder()
                        ->reset()
                        ->uriFor('switchSite', ['site' => $site], 'Backend\Backend', 'Neos.Neos');
                }
                $domainsFound = true;
            }

            $sites[] = [
                'name' => $site->getName(),
                'nodeName' => $site->getNodeName(),
                'uri' => $uri,
                'active' => $active
            ];
        }

        if ($domainsFound === false) {
            $uri = $controllerContext->getUriBuilder()
                ->reset()
                ->setCreateAbsoluteUri(true)
                ->uriFor('index', [], 'Backend\Backend', 'Neos.Neos');
            $sites[0]['uri'] = $uri;
        }

        return $sites;
    }
public function buildSiteList ( ControllerContext $ controllerContext ) { $ requestUriHost = $ controllerContext -> getRequest ( ) -> getHttpRequest ( ) -> getUri ( ) -> getHost ( ) ; $ domainsFound = false ; $ sites = [ ] ; foreach ( $ this -> siteRepository -> findOnline ( ) as $ site ) { $ uri = null ; $ active = false ; /** @var $site Site */ if ( $ site -> hasActiveDomains ( ) ) { $ activeHostPatterns = $ site -> getActiveDomains ( ) -> map ( function ( $ domain ) { return $ domain -> getHostname ( ) ; } ) -> toArray ( ) ; $ active = in_array ( $ requestUriHost , $ activeHostPatterns , true ) ; if ( $ active ) { $ uri = $ controllerContext -> getUriBuilder ( ) -> reset ( ) -> setCreateAbsoluteUri ( true ) -> uriFor ( 'index' , [ ] , 'Backend\Backend' , 'Neos.Neos' ) ; } else { $ uri = $ controllerContext -> getUriBuilder ( ) -> reset ( ) -> uriFor ( 'switchSite' , [ 'site' => $ site ] , 'Backend\Backend' , 'Neos.Neos' ) ; } $ domainsFound = true ; } $ sites [ ] = [ 'name' => $ site -> getName ( ) , 'nodeName' => $ site -> getNodeName ( ) , 'uri' => $ uri , 'active' => $ active ] ; } if ( $ domainsFound === false ) { $ uri = $ controllerContext -> getUriBuilder ( ) -> reset ( ) -> setCreateAbsoluteUri ( true ) -> uriFor ( 'index' , [ ] , 'Backend\Backend' , 'Neos.Neos' ) ; $ sites [ 0 ] [ 'uri' ] = $ uri ; } return $ sites ; }
Build a list of sites

@param ControllerContext $controllerContext
@return array
Build a list of sites