/**
  * Initializes the controller before invoking an action method.
  *
  * @return void
  */
 protected function initializeAction()
 {
     // TODO must check whether site exists, and adjust if necessary
     $this->site = $this->moduleData->getSite();
     try {
         $moduleName = $this->request->getArgument('module');
         if ($this->moduleManager->isRegisteredModule($moduleName)) {
             $this->activeModuleName = $moduleName;
             $this->activeModule = $this->moduleManager->getModule($moduleName);
         }
     } catch (NoSuchArgumentException $e) {
         $this->activeModule = $this->moduleManager->getModule($this->activeModuleName);
     }
     $this->modules = $this->moduleManager->getModules();
 }
 /**
  * Initializes the controller before invoking an action method.
  *
  * @return void
  */
 protected function initializeAction()
 {
     $this->site = $this->moduleData->getSite();
     if (!$this->site instanceof Site) {
         $this->initializeSiteFromFirstAvailableAndStoreInModuleData();
     }
     $rootPageId = $this->site->getRootPageId();
     if ($rootPageId > 0 && !Util::pageExists($rootPageId)) {
         $this->initializeSiteFromFirstAvailableAndStoreInModuleData();
     }
     try {
         $moduleName = $this->request->getArgument('module');
         if ($this->moduleManager->isRegisteredModule($moduleName)) {
             $this->activeModuleName = $moduleName;
             $this->activeModule = $this->moduleManager->getModule($moduleName);
         }
     } catch (NoSuchArgumentException $e) {
         $this->activeModule = $this->moduleManager->getModule($this->activeModuleName);
     }
     $this->moduleManager->sortModules();
     $this->modules = $this->moduleManager->getModules();
 }
 /**
  * Initializes the controller before invoking an action method.
  *
  * @return void
  */
 protected function initializeAction()
 {
     if ($this->request->getControllerActionName() == 'noSiteAvailable') {
         return;
     }
     $this->resolveSite();
     if ($this->site === null) {
         // we could not set the site
         $this->forwardToNonModuleAction('noSiteAvailable');
     }
     try {
         $moduleName = $this->request->getArgument('module');
         if ($this->moduleManager->isRegisteredModule($moduleName)) {
             $this->activeModuleName = $moduleName;
             $this->activeModule = $this->moduleManager->getModule($moduleName);
         }
     } catch (NoSuchArgumentException $e) {
         $this->activeModule = $this->moduleManager->getModule($this->activeModuleName);
     }
     $this->moduleManager->sortModules();
     $this->modules = $this->moduleManager->getModules();
 }