-
Notifications
You must be signed in to change notification settings - Fork 98
Expand file tree
/
Copy pathPlugin.php
More file actions
149 lines (136 loc) · 4.06 KB
/
Copy pathPlugin.php
File metadata and controls
149 lines (136 loc) · 4.06 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
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<?php namespace RainLab\Pages;
use Event;
use Backend;
use RainLab\Pages\Classes\Page as StaticPage;
use RainLab\Pages\Classes\Router;
use Cms\Classes\Theme;
use System\Classes\PluginBase;
/**
* Plugin Information File
*/
class Plugin extends PluginBase
{
/**
* register the Editor extension for the backend Pages editor.
*/
public function register()
{
Event::listen('editor.extension.register', function () {
return \RainLab\Pages\Classes\EditorExtension::class;
});
}
/**
* pluginDetails returns information about this plugin.
*/
public function pluginDetails()
{
return [
'name' => 'Pages',
'description' => 'Pages & menus features.',
'author' => 'Alexey Bobkov, Samuel Georges',
'icon' => 'icon-files-o',
'homepage' => 'https://github.com/rainlab/pages-plugin'
];
}
/**
* registerComponents used by the frontend.
*/
public function registerComponents()
{
return [
\RainLab\Pages\Components\ChildPages::class => 'childPages',
\RainLab\Pages\Components\StaticPage::class => 'staticPage',
\RainLab\Pages\Components\StaticMenu::class => 'staticMenu',
\RainLab\Pages\Components\StaticBreadcrumbs::class => 'staticBreadcrumbs'
];
}
/**
* registerFormWidgets available for backend forms.
*/
public function registerFormWidgets()
{
return [
\RainLab\Pages\FormWidgets\PagePicker::class => 'staticpagepicker',
\RainLab\Pages\FormWidgets\MenuPicker::class => 'staticmenupicker',
];
}
/**
* registerContentFields available for Tailor blueprints, matching the
* form widget aliases so 'type: staticpagepicker' works in a blueprint.
*/
public function registerContentFields()
{
return [
\RainLab\Pages\ContentFields\PagePickerField::class => 'staticpagepicker',
\RainLab\Pages\ContentFields\MenuPickerField::class => 'staticmenupicker',
];
}
/**
* registerPermissions available for backend users.
*/
public function registerPermissions()
{
return [
'rainlab.pages.manage_pages' => [
'tab' => 'Pages',
'order' => 200,
'label' => 'Manage static pages'
],
'rainlab.pages.manage_menus' => [
'tab' => 'Pages',
'order' => 200,
'label' => 'Manage static menus'
],
'rainlab.pages.manage_content' => [
'tab' => 'Pages',
'order' => 200,
'label' => 'Manage static content'
]
];
}
/**
* registerNavigation for the backend, a single item hosting the Vue Editor shell.
*/
public function registerNavigation()
{
return [
'pages' => [
'label' => 'Pages',
'url' => Backend::url('rainlab/pages/index'),
'icon' => 'icon-files-o',
'iconSvg' => 'plugins/rainlab/pages/assets/images/pages-icon.svg',
'permissions' => ['rainlab.pages.*'],
'order' => 200,
'useDropdown' => false
]
];
}
/**
* registerMarkupTags adds the staticPage filter.
*/
public function registerMarkupTags()
{
return [
'filters' => [
'staticPage' => [\RainLab\Pages\Classes\Page::class, 'url', false]
]
];
}
/**
* boot the plugin events.
*/
public function boot()
{
Event::subscribe(\RainLab\Pages\Classes\ExtendCmsModule::class);
}
/**
* clearCache flushes the router and menu caches for the edit theme.
*/
public static function clearCache()
{
$theme = Theme::getEditTheme();
$router = new Router($theme);
$router->clearCache();
StaticPage::clearMenuCache($theme);
}
}