-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathPlugin.php
110 lines (98 loc) · 3.39 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?php
namespace Flynsarmy\Menu;
use Backend;
use System\Classes\PluginBase;
use System\Classes\PluginManager;
/**
* Menus Plugin Information File.
*/
class Plugin extends PluginBase
{
/**
* Returns information about this plugin.
*
* @return array
*/
public function pluginDetails()
{
return [
'name' => 'Menu',
'description' => 'Create flexible menus straight from October CMS admin',
'author' => 'Flyn San',
'icon' => 'icon-bars',
'homepage' => 'https://github.com/Flynsarmy/oc-menu-plugin',
];
}
public function registerNavigation()
{
return [
'menu' => [
'label' => 'Menus',
'url' => Backend::url('flynsarmy/menu/menus'),
'icon' => 'icon-bars',
'permissions' => ['flynsarmy.menu.*'],
'order' => 500,
'sideMenu' => [
'menus' => [
'label' => 'All Menus',
'icon' => 'icon-bars',
'url' => Backend::url('flynsarmy/menu/menus'),
'permissions' => ['flynsarmy.menu.access_menus'],
],
'settings' => [
'label' => 'Settings',
'icon' => 'icon-cog',
'url' => Backend::url('flynsarmy/menu/settings'),
'permissions' => ['flynsarmy.menu.access_menu_settings'],
],
],
],
];
}
public function registerPermissions()
{
return [
'flynsarmy.menu.access_menus' => ['label' => 'Menus - Access Menus', 'tab' => 'Flynsarmy'],
'flynsarmy.menu.access_menu_settings' => ['label' => 'Menus - Access Settings', 'tab' => 'Flynsarmy'],
];
}
public function registerComponents()
{
return [
'\Flynsarmy\Menu\Components\Menu' => 'menu',
];
}
public function register_flynsarmy_menu_item_types()
{
$types = [
'Flynsarmy\\Menu\\MenuItemTypes\\Page' => [
'label' => 'Page',
'alias' => 'page',
'description' => 'A link to a CMS Page',
],
'Flynsarmy\\Menu\\MenuItemTypes\\Partial' => [
'label' => 'Partial',
'alias' => 'partial',
'description' => 'Render a CMS Partial',
],
'Flynsarmy\\Menu\\MenuItemTypes\\Link' => [
'label' => 'Link',
'alias' => 'link',
'description' => 'A given URL',
],
];
if (PluginManager::instance()->hasPlugin('RainLab.Blog')) {
$types['Flynsarmy\\Menu\\MenuItemTypes\\BlogPost'] = [
'label' => 'Blog Post',
'alias' => 'blog_post',
'description' => 'A link to a Blog Post',
];
$types['Flynsarmy\\Menu\\MenuItemTypes\\BlogCategory'] = [
'label' => 'Blog Category',
'alias' => 'blog_category',
'description' => 'A link to a Blog Category',
];
}
return $types;
}
}