From 147189288ffc070d1c9cf396c8b949bcac5c1cba Mon Sep 17 00:00:00 2001 From: versustunez Date: Sun, 6 Dec 2020 12:30:12 +0100 Subject: [PATCH] VENOM-10: Moved Modules to Own File to avoid User have to add it! FIXED composer.json --- base/module.base.php | 4 +--- composer.json | 4 ++-- src/Venom/Admin/AdminModulesLoader.php | 20 ++++++++++++++++++++ src/Venom/Venom.php | 4 ++++ 4 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 src/Venom/Admin/AdminModulesLoader.php diff --git a/base/module.base.php b/base/module.base.php index ea74f37..e51a2b3 100755 --- a/base/module.base.php +++ b/base/module.base.php @@ -1,9 +1,7 @@ need to have the Module Class at parent with the init function ;) -$modules = [ - 'role' => Modules\RoleModule::class -]; +$modules = []; // register controllers that can handle templates ;) need to have a render function for this $controllers = [ diff --git a/composer.json b/composer.json index 718e2ae..0791e73 100755 --- a/composer.json +++ b/composer.json @@ -6,12 +6,12 @@ { "name": "Maurice Grönwoldt", "email": "mauricegroenwoldt@gmail.com", - "description": "founder" + "role": "founder" }, { "name": "Dominic Seela", "email": "kontakt@engineertrooper.com", - "description": "friendly developer, supporter" + "role": "friendly developer, supporter" } ], "require": { diff --git a/src/Venom/Admin/AdminModulesLoader.php b/src/Venom/Admin/AdminModulesLoader.php new file mode 100644 index 0000000..da4b77f --- /dev/null +++ b/src/Venom/Admin/AdminModulesLoader.php @@ -0,0 +1,20 @@ + \Modules\MetaDataModule::class, + 'overview' => \Modules\OverviewModule::class, + 'pages' => \Modules\PageModule::class, + 'role' => \Modules\RoleModule::class, + 'seoUrl' => \Modules\SeoUrlModule::class, + 'users' => \Modules\UserModule::class, + 'venomStatus' => \Modules\VenomStatusModule::class, + ]; + } +} \ No newline at end of file diff --git a/src/Venom/Venom.php b/src/Venom/Venom.php index 1c1421d..cda1587 100755 --- a/src/Venom/Venom.php +++ b/src/Venom/Venom.php @@ -5,6 +5,7 @@ namespace Venom; use Venom\Admin\AdminController; +use Venom\Admin\AdminModulesLoader; use Venom\Admin\AdminRouterInit; use Venom\Core\ArgumentHandler; use Venom\Core\Config; @@ -115,6 +116,9 @@ class Venom public function initModules(array $modules): void { + if (Config::getInstance()->isAdmin()) { + $modules = array_merge(AdminModulesLoader::getModules(), $modules); + } foreach ($modules as $key => $moduleClass) { $module = new $moduleClass; if ($module instanceof Module && $module->register($this)) {