forked from GreenMeteor/chatwee
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Events.php
34 lines (30 loc) · 1.03 KB
/
Events.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
<?php
namespace humhub\modules\chatwee;
use Yii;
use yii\helpers\Url;
use humhub\modules\chatwee\widgets\ChatweeFrame;
use humhub\models\Setting;
class Events extends \yii\base\Object
{
public static function onAdminMenuInit(\yii\base\Event $event)
{
$event->sender->addItem([
'label' => Yii::t('ChatweeModule.base', 'ChatWee Settings'),
'url' => Url::toRoute('/Chatwee/admin/index'),
'group' => 'settings',
'icon' => '<i class="fa fa-discord"></i>',
'isActive' => Yii::$app->controller->module && Yii::$app->controller->module->id == 'chatwee' && Yii::$app->controller->id == 'admin',
'sortOrder' => 650
]);
}
public static function addChatweeFrame($event)
{
if (Yii::$app->user->isGuest) {
return;
}
$event->sender->view->registerAssetBundle(Assets::className());
$event->sender->addWidget(ChatweeFrame::className(), [], [
'sortOrder' => Setting::Get('timeout', 'chatwee')
]);
}
}