theme dependences

This commit is contained in:
2025-01-21 14:14:26 +03:00
parent 3120795eab
commit f421e0c649
121 changed files with 11710 additions and 2 deletions

View File

@ -3,10 +3,12 @@
namespace kernel\services;
use DirectoryIterator;
use kernel\helpers\Debug;
use kernel\helpers\Files;
use kernel\helpers\Manifest;
use kernel\helpers\RESTClient;
use kernel\models\Option;
use ZipArchive;
class ThemeService
{
@ -55,7 +57,25 @@ class ThemeService
public function setActiveTheme(string $theme): void
{
$activeTheme = Option::where("key", "active_theme")->first();
$activeTheme = $this->option::where("key", "active_theme")->first();
$themeInfo = $this->getThemeInfo(getConst($theme));
if (isset($themeInfo['dependence'])) {
$dependence_array = explode(',', $themeInfo['dependence']);
foreach ($dependence_array as $depend) {
$this->moduleService->runInitScript($depend);
}
}
$currentThemeInfo = $this->getActiveThemeInfo();
if (isset($currentThemeInfo['dependence'])) {
$dependence_array = explode(',', $currentThemeInfo['dependence']);
foreach ($dependence_array as $depend) {
$this->moduleService->runDeactivateScript($depend);
}
}
$activeTheme->value = getConst($theme);
$activeTheme->save();
}

View File

@ -8,5 +8,6 @@
"preview": "preview.png",
"resource": "/resources/themes/default",
"resource_path": "{RESOURCES}/themes/default",
"routs": "routs/default.php"
"routs": "routs/default.php",
"dependence": ""
}