This commit is contained in:
2025-08-01 14:29:50 +03:00
parent 2ab819ff30
commit b86b8ff923
54 changed files with 1512 additions and 672 deletions

View File

@@ -278,6 +278,17 @@ class ModuleService
return $routs;
}
public function setModulesHooks(): void
{
$hooks = [];
$modules = $this->getActiveModules();
foreach ($modules as $module) {
if (isset($module['hooks'])) {
include $module['path'] . "/" . $module['hooks'];
}
}
}
/**
* @return array
*/
@@ -644,61 +655,4 @@ class ModuleService
return true;
}
public function createCRUD(array $params, string $modulePath)
{
$slug = $params['slug'];
$model = $params['model'];
$this->createModuleFileByTemplate(
KERNEL_TEMPLATES_DIR . '/controllers/kernel_controller_template',
$modulePath . '/controllers/' . $model . 'Controller.php',
$params
);
$this->createModuleFileByTemplate(
KERNEL_TEMPLATES_DIR . '/models/model_template',
$modulePath . '/models/' . $model . '.php',
$params
);
$this->createModuleFileByTemplate(
KERNEL_TEMPLATES_DIR . '/models/forms/create_form_template',
$modulePath . '/models/forms/Create' . $model . 'Form.php',
$params
);
$this->createModuleFileByTemplate(
KERNEL_TEMPLATES_DIR . '/services/service_template',
$modulePath . '/services/' . $model . 'Service.php',
$params
);
mkdir($modulePath . '/views/' . strtolower($model));
$this->createModuleFileByTemplate(
KERNEL_TEMPLATES_DIR . '/views/index_template',
$modulePath . '/views/' . strtolower($model) . '/index.php',
$params
);
$this->createModuleFileByTemplate(
KERNEL_TEMPLATES_DIR . '/views/view_template',
$modulePath . '/views/' . strtolower($model) . '/view.php',
$params
);
$this->createModuleFileByTemplate(
KERNEL_TEMPLATES_DIR . '/views/form_template',
$modulePath . '/views/' . strtolower($model) . '/form.php',
$params
);
}
public function createController(array $params, string $path): void
{
$slug = $params['slug'];
$model = $params['model'];
$this->createModuleFileByTemplate(
KERNEL_TEMPLATES_DIR . '/controllers/kernel_controller_template',
$path . '/' . $model . 'Controller.php',
$params
);
}
}