-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathPlugin.php
executable file
·95 lines (85 loc) · 2.71 KB
/
Plugin.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?php namespace JorgeAndrade\Events;
use Cms\Classes\Controller;
use Event;
use System\Classes\PluginBase;
/**
* Events Plugin Information File
*/
class Plugin extends PluginBase
{
/**
* Adds date translation to the plugin
*/
public function boot()
{
Event::Listen('cms.page.beforeDisplay', function (Controller $controller, $url, $page) {
if (extension_loaded('intl')) {
$twigIntlExtension = new \Twig_Extensions_Extension_Intl();
if (!$controller->getTwig()->hasExtension($twigIntlExtension->getName())) {
$controller->getTwig()->addExtension($twigIntlExtension);
}
}
});
}
/**
* Returns information about this plugin.
*
* @return array
*/
public function pluginDetails()
{
return [
'name' => 'Calendar Events',
'description' => 'Manage properly your own events',
'author' => 'Jorge Andrade',
'icon' => 'icon-calendar',
'homepage' => 'http://andradedev.com',
];
}
public function registerComponents()
{
return [
'JorgeAndrade\Events\Components\EventList' => 'eventList',
'JorgeAndrade\Events\Components\Event' => 'event',
];
}
public function registerPermissions()
{
return [
'jorgeandrade.events.access_events' => [
'label' => 'Manage the events',
'tab' => 'Events',
],
'jorgeandrade.events.access_calendars' => [
'label' => 'Manage the calendars',
'tab' => 'Events',
],
];
}
public function registerNavigation()
{
return [
'events' => [
'label' => 'Events',
'url' => \Backend::url('jorgeandrade/events/events'),
'icon' => 'icon-calendar',
'permissions' => ['jorgeandrade.events.*'],
'order' => 200,
'sideMenu' => [
'events' => [
'label' => 'Events',
'icon' => 'icon-list',
'url' => \Backend::url('jorgeandrade/events/events'),
'permissions' => ['jorgeandrade.events.access_events'],
],
'calendars' => [
'label' => 'Calendars',
'icon' => 'icon-calendar',
'url' => \Backend::url('jorgeandrade/events/calendars'),
'permissions' => ['jorgeandrade.events.access_calendars'],
],
],
],
];
}
}