forked from stepancher/yii2-comments-module
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBootstrap.php
More file actions
executable file
·48 lines (44 loc) · 1.63 KB
/
Bootstrap.php
File metadata and controls
executable file
·48 lines (44 loc) · 1.63 KB
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
<?php
namespace stepancher\comments;
use yii\base\BootstrapInterface;
/**
* Gallery module bootstrap class.
*/
class Bootstrap implements BootstrapInterface
{
/**
* @inheritdoc
*/
public function bootstrap($app)
{
// Add module URL rules.
$app->getUrlManager()->addRules(
[
'POST <_m:galleries>' => '<_m>/default/create',
'<_m:galleries>' => '<_m>/default/index',
'<_m:galleries>/<id:\d+>-<alias:[a-zA-Z0-9_-]{1,100}+>' => '<_m>/default/view',
]
);
// Add module I18N category.
if (!isset($app->i18n->translations['stepancher/comments']) && !isset($app->i18n->translations['stepancher/*'])) {
$app->i18n->translations['stepancher/comments'] = [
'class' => 'yii\i18n\PhpMessageSource',
'basePath' => '@stepancher/comments/messages',
'forceTranslation' => true,
'fileMap' => [
'stepancher/comments' => 'comments.php',
]
];
}
if (!isset($app->i18n->translations['stepancher/comments-models']) && !isset($app->i18n->translations['stepancher/*'])) {
$app->i18n->translations['stepancher/comments-models'] = [
'class' => 'yii\i18n\PhpMessageSource',
'basePath' => '@stepancher/comments/messages',
'forceTranslation' => true,
'fileMap' => [
'stepancher/comments-models' => 'comments-models.php',
]
];
}
}
}