This repository has been archived by the owner on Dec 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathindex.php
172 lines (126 loc) · 4 KB
/
index.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
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<?php
use Pagekit\Application;
/*
* This array is the module definition.
* It's used by Pagekit to load your extension and register all things
* that your extension provides (routes, menu items, php classes etc)
*/
return [
/*
* Define a unique name.
*/
'name' => 'hello',
/*
* Define the type of this module.
* Has to be 'extension' here. Can be 'theme' for a theme.
*/
'type' => 'extension',
/*
* Main entry point. Called when your extension is both installed and activated.
* Either assign an closure or a string that points to a PHP class.
* Example: 'main' => 'Pagekit\\Hello\\HelloExtension'
*/
'main' => function (Application $app) {
// bootstrap code
},
/*
* Register all namespaces to be loaded.
* Map from namespace to folder where the classes are located.
* Remember to escape backslashes with a second backslash.
*/
'autoload' => [
'Pagekit\\Hello\\' => 'src'
],
/*
* Define nodes. A node is similar to a route with the difference
* that it can be placed anywhere in the menu structure. The
* resulting route is therefore determined on runtime.
*/
'nodes' => [
'hello' => [
// The name of the node route
'name' => '@hello',
// Label to display in the backend
'label' => 'Hello',
// The controller for this node. Each controller action will be mounted
'controller' => 'Pagekit\\Hello\\Controller\\SiteController',
// A unique node that cannot be deleted, resides in "Not Linked" by default
'protected' => true
]
],
/*
* Define routes.
*/
'routes' => [
'/hello' => [
'name' => '@hello/admin',
'controller' => [
'Pagekit\\Hello\\Controller\\HelloController'
]
]
],
/*
* Define menu items for the backend.
*/
'menu' => [
// name, can be used for menu hierarchy
'hello' => [
// Label to display
'label' => 'Hello',
// Icon to display
'icon' => 'hello:icon.svg',
// URL this menu item links to
'url' => '@hello/admin',
// Optional: Expression to check if menu item is active on current url
// 'active' => '@hello*'
// Optional: Limit access to roles which have specific permission assigned
// 'access' => 'hello: manage hellos'
],
'hello: panel' => [
// Parent menu item, makes this appear on 2nd level
'parent' => 'hello',
// See above
'label' => 'Hello',
'icon' => 'hello:icon.svg',
'url' => '@hello/admin'
// 'access' => 'hello: manage hellos'
],
'hello: settings' => [
'parent' => 'hello',
'label' => 'Settings',
'url' => '@hello/admin/settings',
'access' => 'system: manage settings'
]
],
/*
* Define permissions.
* Will be listed in backend and can then be assigned to certain roles.
*/
'permissions' => [
// Unique name.
// Convention: extension name and speaking name of this permission (spaces allowd)
'hello: manage settings' => [
'title' => 'Manage settings'
],
],
/*
* Link to a settings screen from the extensions listing.
*/
'settings' => '@hello/admin/settings',
/*
* Default module configuration.
* Can be overwritten by changed config during runtime.
*/
'config' => [
'default' => 'World'
],
/*
* Listen to events.
*/
'events' => [
'view.scripts' => function ($event, $scripts) {
$scripts->register('hello-link', 'hello:app/bundle/link.js', '~panel-link');
$scripts->register('hello-dashboard', 'hello:app/bundle/dashboard.js', '~dashboard');
}
]
];