-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathModule.php
58 lines (51 loc) · 1.41 KB
/
Module.php
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
namespace wolfguard\video_gallery;
use yii\base\Module as BaseModule;
/**
* This is the main module class for the Yii2-video_gallery.
*
* @property ModelManager $manager
*
* @author Ivan Fedyaev <[email protected]>
*/
class Module extends BaseModule
{
const VERSION = '0.1.0';
/**
* @var string The prefix for video_gallery module URL.
* @See [[GroupUrlRule::prefix]]
*/
public $urlPrefix = 'video-gallery';
/**
* @var array The rules to be used in URL management.
*/
public $urlRules = [
'admin/<action>' => 'admin/<action>'
];
/**
* @inheritdoc
*/
public function __construct($id, $parent = null, $config = [])
{
foreach ($this->getModuleComponents() as $name => $component) {
if (!isset($config['components'][$name])) {
$config['components'][$name] = $component;
} elseif (is_array($config['components'][$name]) && !isset($config['components'][$name]['class'])) {
$config['components'][$name]['class'] = $component['class'];
}
}
parent::__construct($id, $parent, $config);
}
/**
* Returns module components.
* @return array
*/
protected function getModuleComponents()
{
return [
'manager' => [
'class' => 'wolfguard\video_gallery\ModelManager'
],
];
}
}