-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathModule.php
61 lines (54 loc) · 1.45 KB
/
Module.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
namespace humhub\modules\sms;
use Yii;
use yii\helpers\Url;
use humhub\modules\user\models\User;
use humhub\modules\ui\icon\widgets\Icon;
/**
* SmsModule is the WebModule for the sms message system.
*
* This class is also used to process events catched by the autostart.php listeners.
*
* @package humhub.modules.sms
* @since 0.5
* @author Luke
*/
class Module extends \humhub\components\Module
{
/**
* @inheritdoc
*/
public function getContentContainerTypes()
{
return [
User::class,
];
}
/**
* @inheritdoc
*/
public function getConfigUrl()
{
return Url::to(['/sms/config']);
}
/**
* On AccountNavigationWidget init, this callback will be called
* to add some extra navigation items.
*
* (The event is catched in example/autostart.php)
*
* @param type $event
*/
public static function onProfileMenuInit($event)
{
$user = $event->sender->user;
if (Yii::$app->hasModule('sms')) {
$event->sender->addItem([
'label' => Yii::t('SmsModule.base', 'Send SMS'),
'icon' => Icon::get('mobile'),
'isActive' => (Yii::$app->controller->module && Yii::$app->controller->module->id == 'sms' && Yii::$app->controller->id == 'send' && Yii::$app->controller->action->id == 'index'),
'url' => $user->createUrl('//sms/send'),
]);
}
}
}