1 | <?php |
||
34 | class AdminView extends View |
||
35 | { |
||
36 | /** |
||
37 | * Layouts. |
||
38 | */ |
||
39 | const LAYOUT_FIXED = 'fixed'; |
||
40 | const LAYOUT_SIDEBAR_MINI = 'sidebar-mini'; |
||
41 | const LAYOUT_SIDEBAR_COLLAPSE = 'sidebar-collapse'; |
||
42 | const LAYOUT_BOXED = 'layout-boxed'; |
||
43 | const LAYOUT_TOP_NAV = 'layout-top-nav'; |
||
44 | |||
45 | /** |
||
46 | * Skins. |
||
47 | */ |
||
48 | const SKIN_BLUE = 'skin-blue'; |
||
49 | const SKIN_BLUE_LIGHT = 'skin-blue-light'; |
||
50 | const SKIN_YELLOW = 'skin-yellow'; |
||
51 | const SKIN_YELLOW_LIGHT = 'skin-yellow-light'; |
||
52 | const SKIN_GREEN = 'skin-green'; |
||
53 | const SKIN_GREEN_LIGHT = 'skin-green-light'; |
||
54 | const SKIN_PURPLE = 'skin-purple'; |
||
55 | const SKIN_PURPLE_LIGHT = 'skin-purple-light'; |
||
56 | const SKIN_RED = 'skin-red'; |
||
57 | const SKIN_RED_LIGHT = 'skin-red-light'; |
||
58 | const SKIN_BLACK = 'skin-black'; |
||
59 | const SKIN_BLACK_LIGHT = 'skin-black-light'; |
||
60 | |||
61 | /** |
||
62 | * Sidebar menu config. |
||
63 | * |
||
64 | * @var array |
||
65 | */ |
||
66 | public $mainMenuConfig = []; |
||
67 | |||
68 | /** |
||
69 | * Admin layout type. |
||
70 | * |
||
71 | * @var string |
||
72 | */ |
||
73 | public $bodyLayout = self::LAYOUT_SIDEBAR_MINI; |
||
74 | |||
75 | /** |
||
76 | * Admin layout theme. By default are used blue skin. |
||
77 | * |
||
78 | * @var string |
||
79 | */ |
||
80 | public $skin = self::SKIN_BLUE; |
||
81 | |||
82 | /** |
||
83 | * AssetBundle config. |
||
84 | * |
||
85 | * @var null|array|string |
||
86 | */ |
||
87 | public $assetBundleConfig = null; |
||
88 | |||
89 | /** |
||
90 | * Home URL. |
||
91 | * |
||
92 | * @var string |
||
93 | */ |
||
94 | public $homeUrl = '/admin'; |
||
95 | |||
96 | /** |
||
97 | * An array of extra asset. Each asset can be specified one of the following format: |
||
98 | * - a string thar represent a class name of extra asset; |
||
99 | * - an array that must contain a class key and may contain other settings of asset bundle. |
||
100 | * |
||
101 | * @see BaseYii::createObject() |
||
102 | * |
||
103 | * @var array |
||
104 | */ |
||
105 | public $extraAssets = []; |
||
106 | |||
107 | /** |
||
108 | * This array contain a key->value pairs where key - is link name and value is link |
||
109 | * that will be rendered in "user-body" section of menu. |
||
110 | * |
||
111 | * @var string[] |
||
112 | */ |
||
113 | public $userBody = []; |
||
114 | |||
115 | /** |
||
116 | * Asset bundle class-name using by default for admin view. |
||
117 | * |
||
118 | * @var string |
||
119 | */ |
||
120 | private $defaultAssetBundleClass = AdminAsset::class; |
||
121 | |||
122 | /** |
||
123 | * Company name. |
||
124 | * |
||
125 | * @var string |
||
126 | */ |
||
127 | public $companyName = 'Company'; |
||
128 | |||
129 | /** |
||
130 | * Short company name. |
||
131 | * |
||
132 | * @var string |
||
133 | */ |
||
134 | public $shotCompanyName = ''; |
||
135 | |||
136 | /** |
||
137 | * Link to user profile. |
||
138 | * |
||
139 | * @var string |
||
140 | */ |
||
141 | public $profileLink = '/profile'; |
||
142 | |||
143 | /** |
||
144 | * Link to sign-out action. |
||
145 | * |
||
146 | * @var string |
||
147 | */ |
||
148 | public $signOutLink = '/site/logout'; |
||
149 | |||
150 | /** |
||
151 | * Initializes the object. |
||
152 | * |
||
153 | * @return void |
||
154 | */ |
||
155 | public function init(): void |
||
160 | |||
161 | /** |
||
162 | * Register a main admin asset. |
||
163 | * |
||
164 | * @return void |
||
165 | */ |
||
166 | private function registerAdminAsset(): void |
||
171 | |||
172 | /** |
||
173 | * Register an extra assets. |
||
174 | * |
||
175 | * @return void |
||
176 | */ |
||
177 | private function registerExtraAssets(): void |
||
184 | |||
185 | /** |
||
186 | * Register an asset bundle in view. |
||
187 | * |
||
188 | * @param array $assetConfig config of asset bundle. |
||
189 | * |
||
190 | * @return void |
||
191 | */ |
||
192 | private function registerAsset(array $assetConfig): void |
||
203 | |||
204 | /** |
||
205 | * Return config array for create instance of AssetBundle. |
||
206 | * |
||
207 | * @return array |
||
208 | */ |
||
209 | private function getAdminAssetConfig(): array |
||
227 | |||
228 | /** |
||
229 | * Prepare and return an extra asset config. |
||
230 | * |
||
231 | * @param string|array $asset extra asset config. |
||
232 | * |
||
233 | * @throws InvalidConfigException if the configuration is invalid. |
||
234 | * |
||
235 | * @return array |
||
236 | */ |
||
237 | private function getExtraAssetConfig($asset): array |
||
251 | } |
||
252 |