forked from stfnhmplr/pagekit-gallery
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
178 lines (140 loc) · 4.67 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
173
174
175
176
177
178
<?php
use Pagekit\Application;
use Shw\Gallery\Events\RouteListener;
use Shw\Gallery\Content\MiniGalleryPlugin;
/*
* 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 [
'name' => 'gallery',
'type' => 'extension',
'main' => function (Application $app) {
},
/*
* 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' => [
'Shw\\Gallery\\' => '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' => [
'Gallery' => [
// The name of the node route
'name' => '@gallery',
// Label to display in the backend
'label' => 'Gallery',
// The controller for this node. Each controller action will be mounted
'controller' => 'Shw\\Gallery\\Controller\\SiteController',
// A unique node that cannot be deleted, resides in "Not Linked" by default
'protected' => true
]
],
/*
* Define routes.
*/
'routes' => [
'/gallery' => [
'name' => '@gallery/admin',
'controller' => [
'Shw\\Gallery\\Controller\\GalleryController'
]
],
'/api/gallery' => [
'name' => '@gallery/api',
'controller' => [
'Shw\\Gallery\\Controller\\GalleryApiController',
'Shw\\Gallery\\Controller\\ImageApiController'
]
]
],
/*
* Define menu items for the backend.
*/
'menu' => [
// name, can be used for menu hierarchy
'gallery' => [
'label' => 'Gallery',
'icon' => 'gallery:icon.svg',
'url' => '@gallery/admin',
'access' => 'gallery: manage own galleries'
],
'gallery: panel' => [
// Parent menu item, makes this appear on 2nd level
'parent' => 'gallery',
'label' => 'Gallery',
'icon' => 'gallery:icon.svg',
'url' => '@gallery/admin',
'access' => 'gallery: manage own galleries'
],
'gallery: settings' => [
'parent' => 'gallery',
'label' => 'Settings',
'url' => '@gallery/admin/settings',
'access' => 'gallery: manage settings'
]
],
/*
* Define permissions.
* Will be listed in backend and can then be assigned to certain roles.
*/
'permissions' => [
'gallery: manage own galleries' => [
'title' => 'Manage own galleries',
'description' => 'Create, edit, delete and publish galleries of their own'
],
'gallery: manage all galleries' => [
'title' => 'Manage all galleries',
'description' => 'Create, edit, delete and publish galleries by all users'
],
'gallery: manage settings' => [
'title' => 'Manage settings'
],
],
/*
* Link to a settings screen from the extensions listing.
*/
'settings' => '@gallery/admin/settings',
/*
* Default module configuration.
* Can be overwritten by changed config during runtime.
*/
'config' => [
'gallery' => [
'title' => 'Gallery',
'back_button' => false
],
'images' => [
'image_width' => 1200,
'image_height' => 1200,
'thumbnail_width' => 150,
'thumbnail_height' => 100,
'image_quality' => 90,
]
],
/*
* Listen to events.
*/
'events' => [
'boot' => function ($event, $app) {
$app->subscribe(
new RouteListener,
new MiniGalleryPlugin
);
},
'view.scripts' => function ($event, $scripts) {
$scripts->register('gallery-link', 'gallery:app/bundle/link-gallery.js', '~panel-link');
$scripts->register('gallery-dashboard', 'gallery:app/bundle/gallery-dashboard.js', '~dashboard');
$scripts->register('gallery-meta', 'gallery:app/bundle/gallery-meta.js', '~gallery-edit');
$scripts->register('gallery-images', 'gallery:app/bundle/gallery-images.js', '~gallery-edit');
//$scripts->register('minigallery', 'gallery:app/bundle/minigallery.js', ['~editor']);
}
]
];