-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathThemeSettingsModel.php
More file actions
44 lines (35 loc) · 934 Bytes
/
ThemeSettingsModel.php
File metadata and controls
44 lines (35 loc) · 934 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
namespace panix\engine;
use Yii;
use yii\helpers\ArrayHelper;
use yii\base\InvalidConfigException;
use panix\engine\base\Model;
use panix\engine\components\Settings;
use yii\helpers\VarDumper;
/**
* Class ThemeSettingsModel
* @package panix\engine
*/
class ThemeSettingsModel extends SettingsModel
{
public function init()
{
if (!isset($this->module)) {
throw new InvalidConfigException(Yii::t('yii', 'Missing required parameters: {params}', [
'params' => 'module'
]));
}
if (static::$category == null) {
static::$category = $this->module;
}
$this->setAttributes((array)Yii::$app->view->theme->get());
}
public function attributeLabels()
{
return [];
}
public function save()
{
Yii::$app->view->theme->set(Yii::$app->settings->get('app', 'theme'), $this->attributes);
}
}