This repository was archived by the owner on Jan 18, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEvents.php
More file actions
62 lines (55 loc) · 1.96 KB
/
Events.php
File metadata and controls
62 lines (55 loc) · 1.96 KB
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
62
<?php
namespace energy\souls\modules;
use humhub\modules\admin\permissions\ManageModules;
use humhub\modules\admin\widgets\AdminMenu;
use humhub\modules\ui\menu\MenuLink;
use humhub\widgets\TopMenu;
use Yii;
use yii\base\Event;
class Events
{
/**
* Defines what to do when the top menu is initialized.
*
* @param $event
*/
public static function onTopMenuInit($event)
{
/** @var TopMenu $topMenuWidget */
$topMenuWidget = $event->sender;
// Matcher
$topMenuWidget->addEntry(new MenuLink([
'label' => Yii::t('SoulsModule.base', 'Matcher'),
'icon' => 'users',
'url' => ['/souls/matcher'],
'sortOrder' => 1,
'isActive' => (Yii::$app->controller->module && Yii::$app->controller->module->id == 'souls' && Yii::$app->controller->id == 'matcher'),
]));
// Topics
// $topMenuWidget->addEntry(new MenuLink([
// 'label' => Yii::t('SoulsModule.base', 'Topics'),
// 'icon' => 'comments',
// 'url' => ['/souls/topics'],
// 'sortOrder' => 2,
// 'isActive' => (Yii::$app->controller->module && Yii::$app->controller->module->id == 'souls' && Yii::$app->controller->id == 'topics'),
// ]));
}
/**
* Defines what to do if admin menu is initialized.
*
* @param $event Event
*/
public static function onAdminMenuInit($event)
{
/** @var AdminMenu $adminMenuWidget */
$adminMenuWidget = $event->sender;
$adminMenuWidget->addEntry(new MenuLink([
'label' => Yii::t('SoulsModule.base', 'Souls'),
'url' => ['/souls/admin'],
'icon' => 'users',
'sortOrder' => 1,
'isActive' => (Yii::$app->controller->module && Yii::$app->controller->module->id == 'souls' && Yii::$app->controller->id == 'admin'),
'isVisible' => Yii::$app->user->can(ManageModules::class)
]));
}
}