theme dependences
This commit is contained in:
@ -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();
|
||||
}
|
||||
|
Reference in New Issue
Block a user