VENOM-10: Moved Modules to Own File to avoid User have to add it!
FIXED composer.json
This commit is contained in:
parent
f9dd03193e
commit
147189288f
4 changed files with 27 additions and 5 deletions
|
@ -1,9 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
//register modules -> need to have the Module Class at parent with the init function ;)
|
//register modules -> need to have the Module Class at parent with the init function ;)
|
||||||
$modules = [
|
$modules = [];
|
||||||
'role' => Modules\RoleModule::class
|
|
||||||
];
|
|
||||||
|
|
||||||
// register controllers that can handle templates ;) need to have a render function for this
|
// register controllers that can handle templates ;) need to have a render function for this
|
||||||
$controllers = [
|
$controllers = [
|
||||||
|
|
|
@ -6,12 +6,12 @@
|
||||||
{
|
{
|
||||||
"name": "Maurice Grönwoldt",
|
"name": "Maurice Grönwoldt",
|
||||||
"email": "mauricegroenwoldt@gmail.com",
|
"email": "mauricegroenwoldt@gmail.com",
|
||||||
"description": "founder"
|
"role": "founder"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Dominic Seela",
|
"name": "Dominic Seela",
|
||||||
"email": "kontakt@engineertrooper.com",
|
"email": "kontakt@engineertrooper.com",
|
||||||
"description": "friendly developer, supporter"
|
"role": "friendly developer, supporter"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
|
|
20
src/Venom/Admin/AdminModulesLoader.php
Normal file
20
src/Venom/Admin/AdminModulesLoader.php
Normal 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,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,6 +5,7 @@ namespace Venom;
|
||||||
|
|
||||||
|
|
||||||
use Venom\Admin\AdminController;
|
use Venom\Admin\AdminController;
|
||||||
|
use Venom\Admin\AdminModulesLoader;
|
||||||
use Venom\Admin\AdminRouterInit;
|
use Venom\Admin\AdminRouterInit;
|
||||||
use Venom\Core\ArgumentHandler;
|
use Venom\Core\ArgumentHandler;
|
||||||
use Venom\Core\Config;
|
use Venom\Core\Config;
|
||||||
|
@ -115,6 +116,9 @@ class Venom
|
||||||
|
|
||||||
public function initModules(array $modules): void
|
public function initModules(array $modules): void
|
||||||
{
|
{
|
||||||
|
if (Config::getInstance()->isAdmin()) {
|
||||||
|
$modules = array_merge(AdminModulesLoader::getModules(), $modules);
|
||||||
|
}
|
||||||
foreach ($modules as $key => $moduleClass) {
|
foreach ($modules as $key => $moduleClass) {
|
||||||
$module = new $moduleClass;
|
$module = new $moduleClass;
|
||||||
if ($module instanceof Module && $module->register($this)) {
|
if ($module instanceof Module && $module->register($this)) {
|
||||||
|
|
Loading…
Reference in a new issue