public function loadModules(array $moduleSettings)
{
$moduleManager = $this->getDI()->getModuleManager();
if ($this->getEnvironment() == 'production') {
$cachePrefix = $this->getAppName();
$cacheFile = $this->getConfigPath() . "/_cache.{$cachePrefix}.modules.php";
$moduleManager->setCacheFile($cacheFile);
}
$moduleManager->setDefaultPath($this->getModulesPath())->loadModules($moduleSettings, $this->getAppName());
if ($this->getDI()->getConfig()->debug) {
$cachePrefix = $this->getAppName();
$this->writeCache($this->getConfigPath() . "/_debug.{$cachePrefix}.modules.php", $moduleManager->getModules());
}
$this->getApplication()->registerModules($moduleManager->getModules());
//Overwirte default modulemanager
$this->getDI()->set('moduleManager', $moduleManager);
return $this;
}