-
Notifications
You must be signed in to change notification settings - Fork 18
/
index.php
142 lines (104 loc) · 3.17 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
<?php
return [
'name' => 'bixie/formmaker',
'type' => 'extension',
'main' => 'Bixie\\Formmaker\\FormmakerModule',
'autoload' => [
'Bixie\\Formmaker\\' => 'src'
],
'routes' => [
'/formmaker' => [
'name' => '@formmaker',
'controller' => [
'Bixie\\Formmaker\\Controller\\FormmakerController',
'Bixie\\Formmaker\\Controller\\FormController',
'Bixie\\Formmaker\\Controller\\SiteController'
]
],
'/api/formmaker' => [
'name' => '@formmaker/api',
'controller' => [
'Bixie\\Formmaker\\Controller\\FieldApiController',
'Bixie\\Formmaker\\Controller\\FormApiController',
'Bixie\\Formmaker\\Controller\\SubmissionApiController'
]
]
],
'widgets' => [
'widgets/siteform.php'
],
'fieldtypes' => 'fieldtypes',
'resources' => [
'bixie/formmaker:' => ''
],
'menu' => [
'formmaker' => [
'label' => 'Formmaker',
'icon' => 'packages/bixie/formmaker/icon.svg',
'url' => '@formmaker',
// 'access' => 'formmaker: manage hellos',
'active' => '@formmaker(/*)'
],
'formmaker: forms' => [
'label' => 'Forms',
'parent' => 'formmaker',
'url' => '@formmaker',
'access' => 'formmaker: manage forms',
'active' => '@formmaker(/edit)?'
],
'formmaker: submissions' => [
'label' => 'Submissions',
'parent' => 'formmaker',
'url' => '@formmaker/submissions',
'access' => 'formmaker: manage submissions',
'active' => '@formmaker/submissions'
]
],
'permissions' => [
'formmaker: manage settings' => [
'title' => 'Manage settings'
],
'formmaker: manage forms' => [
'title' => 'Manage forms'
],
'formmaker: manage submissions' => [
'title' => 'Manage submissions'
]
],
'settings' => 'settings-formmaker',
'config' => [
'from_address' => '',
'recaptha_sitekey' => '',
'recaptha_secret_key' => '',
'submissions_per_page' => 20
],
'events' => [
'view.scripts' => function ($event, $scripts) use ($app) {
$version = $app->module('bixie/pk-framework')->getVersionKey($app->package('bixie/formmaker')->get('version'));
if ($app['user']->hasAccess('formmaker: manage submissions')) {
$scripts->register('widget-formmaker', 'bixie/formmaker:app/bundle/widget-formmaker.js', ['~dashboard'], ['version' => $version]);
}
$scripts->register('formmaker-settings', 'bixie/formmaker:app/bundle/settings.js', '~extensions', ['version' => $version]);
$scripts->register('link-formmaker', 'bixie/formmaker:app/bundle/link-formmaker.js', '~panel-link', ['version' => $version]);
},
'view.data' => function ($event, $data) use ($app) {
$route = $app->request()->attributes->get('_route');
if (strpos($route, '@formmaker') === 0) {
$data->add('$fieldtypes', [
'ajax_url' => 'api/formmaker/submission/ajax'
]);
}
},
'view.styles' => function ($event, $styles) use ($app) {
$route = $app->request()->attributes->get('_route');
if (strpos($route, '@formmaker') === 0) {
foreach ($app->module('bixie/formmaker')->getFieldTypes() as $type) {
$type->addStyles($styles);
}
}
},
'console.init' => function ($event, $console) {
$console->add(new \Bixie\Formmaker\Console\Commands\TranslateCommand());
}
]
];