-
Notifications
You must be signed in to change notification settings - Fork 2
/
Events.php
40 lines (34 loc) · 1 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
35
36
37
38
39
40
<?php
namespace humhub\modules\chat;
use Yii;
use yii\helpers\Url;
use humhub\modules\chat\widgets\Notifications;
class Events extends \yii\base\Object
{
/**
* On build of the TopMenu, check if module is enabled
* When enabled add a menu item
*
* @param type $event
*/
public static function onTopMenuInit($event)
{
if (Yii::$app->user->isGuest) {
return;
}
$event->sender->addItem(array(
'label' => Yii::t('ChatModule.base', 'Chat'),
'url' => Url::to(['/chat/index']),
'icon' => '<i class="fa fa-weixin"></i>',
'isActive' => (Yii::$app->controller->module && Yii::$app->controller->module->id == 'chat'),
'sortOrder' => 400,
));
}
public static function onNotificationAddonInit($event)
{
if (Yii::$app->user->isGuest) {
return;
}
$event->sender->addWidget(Notifications::className(), array(), array('sortOrder' => 90));
}
}