Example #1
0
 /**
  * Set modules.
  *
  * @param Application $app the application currently running
  */
 protected function setModule($app)
 {
     foreach (Module::getActiveModules() as $module) {
         // Get module backend config.
         if ($moduleConfig = $module->backendConfig) {
             // Set module.
             $app->setModules([$module->module_name => $moduleConfig]);
             // Merge application params with exist module params.
             if (is_file($module->paramPath)) {
                 $moduleParam = (require $module->paramPath);
                 if (isset($moduleParam['backend'])) {
                     $app->params = ArrayHelper::merge($app->params, $moduleParam['backend']);
                 }
             }
             // Bootstrap injection.
             if ($module->module_fb) {
                 $component = $app->getModule($module->module_name);
                 if ($component instanceof BootstrapInterface) {
                     $component->bootstrap($app);
                 }
             }
         }
     }
 }
Example #2
0
 /**
  * Set modules.
  *
  * @param Application $app the application currently running
  */
 protected function setModule($app)
 {
     foreach (Module::getActiveModules() as $module) {
         // Get module backend config.
         if ($config = $module->getFrontendConfig()) {
             // Set module.
             $app->setModules([$module->name => $config]);
             // Merge application params with exist module params.
             if (is_file($module->getParamPath())) {
                 $params = (require $module->getParamPath());
                 if ($frontendParams = ArrayHelper::getValue($params, 'frontend')) {
                     $app->params = ArrayHelper::merge($app->params, $frontendParams);
                 }
             }
             // Bootstrap injection.
             if ($module->frontend_bootstrap) {
                 $component = $app->getModule($module->name);
                 if ($component instanceof BootstrapInterface) {
                     $component->bootstrap($app);
                 }
             }
         }
     }
 }