-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathModule.php
57 lines (45 loc) · 1.32 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
<?php
namespace budyaga\users;
use Yii;
class Module extends \yii\base\Module
{
public $controllerNamespace = 'budyaga\users\controllers';
public $userPhotoUrl = '';
public $userPhotoPath = '';
public $customViews = [];
public $customMailViews = [];
public function init()
{
parent::init();
self::registerTranslations();
}
public static function registerTranslations()
{
if (!isset(Yii::$app->i18n->translations['users']) && !isset(Yii::$app->i18n->translations['users/*'])) {
Yii::$app->i18n->translations['users'] = [
'class' => 'yii\i18n\PhpMessageSource',
'basePath' => '@budyaga/users/messages',
'forceTranslation' => true,
'fileMap' => [
'users' => 'users.php'
]
];
}
}
public function getCustomView($default)
{
if (isset($this->customViews[$default])) {
return $this->customViews[$default];
} else {
return $default;
}
}
public function getCustomMailView($default)
{
if (isset($this->customMailViews[$default])) {
return $this->customMailViews[$default];
} else {
return '@budyaga/users/mail/' . $default;
}
}
}