-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathEvents.php
40 lines (35 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
35
36
37
38
39
40
<?php
namespace humhub\modules\spotify;
use Yii;
use yii\helpers\Url;
use yii\base\BaseObject;
use humhub\models\Setting;
class Events extends BaseObject
{
/**
* @param $event yii\base\Event
*/
public static function onAdminMenuInit($event)
{
$event->sender->addItem([
'label' => Yii::t('SpotifyModule.base', 'Spotify Settings'),
'url' => Url::toRoute('/spotify/admin/index'),
'group' => 'settings',
'icon' => '<i class="fa fa-spotify"></i>',
'isActive' => Yii::$app->controller->module && Yii::$app->controller->module->id == 'spotify' && Yii::$app->controller->id == 'admin',
'sortOrder' => 650
]);
}
/**
* @param $event yii\base\Event
*/
public static function addSpotifyFrame($event)
{
if (Yii::$app->user->isGuest) {
return;
}
$event->sender->addWidget(widgets\SpotifyFrame::class, [], [
'sortOrder' => Setting::Get('timeout', 'spotify')
]);
}
}