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