-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathEvents.php
34 lines (30 loc) · 1.04 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\facebook;
use Yii;
use yii\helpers\Url;
use humhub\modules\facebook\widgets\FacebookFrame;
use humhub\models\Setting;
class Events extends \yii\base\BaseObject
{
public static function onAdminMenuInit(\yii\base\Event $event)
{
$event->sender->addItem([
'label' => Yii::t('FacebookModule.base', 'Facebook Settings'),
'url' => Url::toRoute('/facebook/admin/index'),
'group' => 'settings',
'icon' => '<i class="fa fa-facebook"></i>',
'isActive' => Yii::$app->controller->module && Yii::$app->controller->module->id == 'facebook' && Yii::$app->controller->id == 'admin',
'sortOrder' => 650
]);
}
public static function addFacebookFrame($event)
{
if (Yii::$app->user->isGuest) {
return;
}
$event->sender->view->registerAssetBundle(Assets::class);
$event->sender->addWidget(FacebookFrame::class, [], [
'sortOrder' => Setting::Get('timeout', 'facebook')
]);
}
}