-
Notifications
You must be signed in to change notification settings - Fork 7
/
Module.php
52 lines (42 loc) · 1.01 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
<?php namespace UrlAlias;
use Yii;
use yii\base\Module as BaseModule;
use yii\base\BootstrapInterface;
class Module extends BaseModule implements BootstrapInterface
{
/**
* @var string
*/
public $configPath = '/config/module.php';
/**
* @var string
*/
public $connectionID = 'db';
/**
* @var string
*/
public $routeCachePrefix = 'route_';
/**
* @var int
*/
public $defaultRedirectCode = 302;
/**
* @var array
*/
public $indexSlugMap = ['index', 'site/index'];
public $urlAliasAdminName = 'admin/rule';
public function init() {
parent::init();
Yii::configure($this, require $this->configPath);
}
/**
* @inheritdoc
* @param \yii\web\Application $app
*/
public function bootstrap($app)
{
$app->getUrlManager()->addRules([
$this->urlAliasAdminName . '/<controller:[\w\-]+>/<action:[\w\-]+>' => $this->id . '/<controller>/<action>',
], false);
}
}