-
Notifications
You must be signed in to change notification settings - Fork 15
/
Bootstrap.php
executable file
·39 lines (35 loc) · 1.17 KB
/
Bootstrap.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
<?php
namespace vova07\users;
use yii\base\BootstrapInterface;
/**
* Users module bootstrap class.
*/
class Bootstrap implements BootstrapInterface
{
/**
* @inheritdoc
*/
public function bootstrap($app)
{
// Add module URL rules.
$app->urlManager->addRules(
[
'<_m:users>' => '<_m>/default/index',
'<_a:(login|signup|activation|recovery|recovery-confirmation|resend)>' => 'users/guest/<_a>',
'<_a:logout>' => 'users/user/<_a>',
'<_a:email>' => 'users/default/<_a>',
'<_m:users>/<username:[a-zA-Z0-9_-]{3,20}+>' => '<_m>/default/view',
'my/settings/<_a:[\w\-]+>' => 'users/user/<_a>',
],
false
);
// Add module I18N category.
if (!isset($app->i18n->translations['users']) && !isset($app->i18n->translations['users*'])) {
$app->i18n->translations['users'] = [
'class' => 'yii\i18n\PhpMessageSource',
'basePath' => '@vova07/users/messages',
'forceTranslation' => true
];
}
}
}