| @@ 75-98 (lines=24) @@ | ||
| 72 | * |
|
| 73 | * @param Application $app the application currently running |
|
| 74 | */ |
|
| 75 | protected function setModule($app) |
|
| 76 | { |
|
| 77 | foreach (Module::getActiveModules() as $module) { |
|
| 78 | // Get module backend config. |
|
| 79 | if ($config = $module->getBackendConfig()) { |
|
| 80 | // Set module. |
|
| 81 | $app->setModules([$module->name => $config]); |
|
| 82 | // Merge application params with exist module params. |
|
| 83 | if (is_file($module->getParamPath())) { |
|
| 84 | $params = require($module->getParamPath()); |
|
| 85 | if ($backendParams = ArrayHelper::getValue($params, 'backend')) { |
|
| 86 | $app->params = ArrayHelper::merge($app->params, $backendParams); |
|
| 87 | } |
|
| 88 | } |
|
| 89 | // Bootstrap injection. |
|
| 90 | if ($module->backend_bootstrap) { |
|
| 91 | $component = $app->getModule($module->name); |
|
| 92 | if ($component instanceof BootstrapInterface) { |
|
| 93 | $component->bootstrap($app); |
|
| 94 | } |
|
| 95 | } |
|
| 96 | } |
|
| 97 | } |
|
| 98 | } |
|
| 99 | } |
|
| 100 | ||
| @@ 81-104 (lines=24) @@ | ||
| 78 | * |
|
| 79 | * @param Application $app the application currently running |
|
| 80 | */ |
|
| 81 | protected function setModule($app) |
|
| 82 | { |
|
| 83 | foreach (Module::getActiveModules() as $module) { |
|
| 84 | // Get module backend config. |
|
| 85 | if ($config = $module->getFrontendConfig()) { |
|
| 86 | // Set module. |
|
| 87 | $app->setModules([$module->name => $config]); |
|
| 88 | // Merge application params with exist module params. |
|
| 89 | if (is_file($module->getParamPath())) { |
|
| 90 | $params = require($module->getParamPath()); |
|
| 91 | if ($frontendParams = ArrayHelper::getValue($params, 'frontend')) { |
|
| 92 | $app->params = ArrayHelper::merge($app->params, $frontendParams); |
|
| 93 | } |
|
| 94 | } |
|
| 95 | // Bootstrap injection. |
|
| 96 | if ($module->frontend_bootstrap) { |
|
| 97 | $component = $app->getModule($module->name); |
|
| 98 | if ($component instanceof BootstrapInterface) { |
|
| 99 | $component->bootstrap($app); |
|
| 100 | } |
|
| 101 | } |
|
| 102 | } |
|
| 103 | } |
|
| 104 | } |
|
| 105 | } |
|
| 106 | ||