VENOM-10: Moved Modules to Own File to avoid User have to add it!

FIXED composer.json
This commit is contained in:
Maurice Grönwoldt 2020-12-06 12:30:12 +01:00
parent f9dd03193e
commit 147189288f
4 changed files with 27 additions and 5 deletions

View file

@ -1,9 +1,7 @@
<?php
//register modules -> 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 = [

View file

@ -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": {

View file

@ -0,0 +1,20 @@
<?php
namespace Venom\Admin;
class AdminModulesLoader
{
public static function getModules(): array
{
return [
'metaData' => \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,
];
}
}

View file

@ -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)) {