/** * 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; }
/** * @return void */ public function initializeObject() { $domain = $this->domainRepository->findOneByActiveRequest(); // Set active asset collection to the current site's asset collection, if it has one, on the first view if a matching domain is found if ($domain !== null && !$this->browserState->get('activeAssetCollection') && $this->browserState->get('automaticAssetCollectionSelection') !== true && $domain->getSite()->getAssetCollection() !== null) { $this->browserState->set('activeAssetCollection', $domain->getSite()->getAssetCollection()); $this->browserState->set('automaticAssetCollectionSelection', true); } }
/** * Create a Context for a workspace given by name to be used in this controller. * * @param string $workspaceName Name of the current workspace * @return \Neos\ContentRepository\Domain\Service\Context */ protected function createContext($workspaceName) { $contextProperties = array('workspaceName' => $workspaceName); $currentDomain = $this->domainRepository->findOneByActiveRequest(); if ($currentDomain !== null) { $contextProperties['currentSite'] = $currentDomain->getSite(); $contextProperties['currentDomain'] = $currentDomain; } return $this->contextFactory->create($contextProperties); }
/** * Default action, displays the login screen * * @param string $username Optional: A username to pre-fill into the username field * @param boolean $unauthorized * @return void */ public function indexAction($username = null, $unauthorized = false) { if ($this->securityContext->getInterceptedRequest() || $unauthorized) { $this->response->setStatus(401); } if ($this->authenticationManager->isAuthenticated()) { $this->redirect('index', 'Backend\\Backend'); } $currentDomain = $this->domainRepository->findOneByActiveRequest(); $currentSite = $currentDomain !== null ? $currentDomain->getSite() : $this->siteRepository->findDefault(); $this->view->assignMultiple(['styles' => array_filter($this->settings['userInterface']['backendLoginForm']['stylesheets']), 'username' => $username, 'site' => $currentSite]); }
/** * @return string */ public function render() { $configuration = array('window.T3Configuration = {};', 'window.T3Configuration.UserInterface = ' . json_encode($this->settings['userInterface']) . ';', 'window.T3Configuration.nodeTypes = {};', 'window.T3Configuration.nodeTypes.groups = ' . json_encode($this->getNodeTypeGroupsSettings()) . ';', 'window.T3Configuration.requirejs = {};', 'window.T3Configuration.neosStaticResourcesBaseUri = ' . json_encode($this->resourceManager->getPublicPackageResourceUri('Neos.Neos', '')) . ';', 'window.T3Configuration.requirejs.paths = ' . json_encode($this->getRequireJsPathMapping()) . ';', 'window.T3Configuration.maximumFileUploadSize = ' . $this->renderMaximumFileUploadSize()); $neosJavaScriptBasePath = $this->getStaticResourceWebBaseUri('resource://Neos.Neos/Public/JavaScript'); $configuration[] = 'window.T3Configuration.neosJavascriptBasePath = ' . json_encode($neosJavaScriptBasePath) . ';'; if ($this->backendAssetsUtility->shouldLoadMinifiedJavascript()) { $configuration[] = 'window.T3Configuration.neosJavascriptVersion = ' . json_encode($this->backendAssetsUtility->getJavascriptBuiltVersion()) . ';'; } if ($this->bootstrap->getContext()->isDevelopment()) { $configuration[] = 'window.T3Configuration.DevelopmentMode = true;'; } if ($activeDomain = $this->domainRepository->findOneByActiveRequest()) { $configuration[] = 'window.T3Configuration.site = "' . $activeDomain->getSite()->getNodeName() . '";'; } return implode("\n", $configuration); }