1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Backend\Modules\Pages\Installer; |
4
|
|
|
|
5
|
|
|
use Backend\Core\Installer\ModuleInstaller; |
6
|
|
|
use Backend\Core\Engine\Model as BackendModel; |
7
|
|
|
use Backend\Modules\Pages\Engine\Model as BackendPagesModel; |
8
|
|
|
use Common\ModuleExtraType; |
9
|
|
|
use SpoonFilter; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* Installer for the pages module |
13
|
|
|
*/ |
14
|
|
|
class Installer extends ModuleInstaller |
15
|
|
|
{ |
16
|
|
|
/** @var array */ |
17
|
|
|
private $extraIds; |
18
|
|
|
|
19
|
|
|
public function install(): void |
20
|
|
|
{ |
21
|
|
|
$this->addModule('Pages'); |
22
|
|
|
$this->importSQL(__DIR__ . '/Data/install.sql'); |
23
|
|
|
$this->importLocale(__DIR__ . '/Data/locale.xml'); |
24
|
|
|
$this->configureBackendNavigation(); |
25
|
|
|
$this->configureBackendRights(); |
26
|
|
|
$this->configureFrontendExtras(); |
27
|
|
|
$this->configureFrontendPages(); |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
private function configureBackendNavigation(): void |
31
|
|
|
{ |
32
|
|
|
// Set navigation for "Pages" |
33
|
|
|
$this->setNavigation(null, $this->getModule(), 'pages/index', ['pages/add', 'pages/edit'], 2); |
34
|
|
|
|
35
|
|
|
// Set navigation for "Settings" |
36
|
|
|
$navigationSettingsId = $this->setNavigation(null, 'Settings'); |
37
|
|
|
$navigationModulesId = $this->setNavigation($navigationSettingsId, 'Modules'); |
38
|
|
|
$this->setNavigation($navigationModulesId, $this->getModule(), 'pages/settings'); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
private function configureBackendRights(): void |
42
|
|
|
{ |
43
|
|
|
$this->setModuleRights(1, $this->getModule()); |
44
|
|
|
|
45
|
|
|
$this->setActionRights(1, $this->getModule(), 'Add'); |
46
|
|
|
$this->setActionRights(1, $this->getModule(), 'Delete'); |
47
|
|
|
$this->setActionRights(1, $this->getModule(), 'Edit'); |
48
|
|
|
$this->setActionRights(1, $this->getModule(), 'Copy'); |
49
|
|
|
$this->setActionRights(1, $this->getModule(), 'GetInfo'); // AJAX |
50
|
|
|
$this->setActionRights(1, $this->getModule(), 'Index'); |
51
|
|
|
$this->setActionRights(1, $this->getModule(), 'Move'); // AJAX |
52
|
|
|
$this->setActionRights(1, $this->getModule(), 'RemoveUploadedFile'); // AJAX |
53
|
|
|
$this->setActionRights(1, $this->getModule(), 'Settings'); |
54
|
|
|
$this->setActionRights(1, $this->getModule(), 'UploadFile'); // AJAX |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @todo: When we have Page entities, use DataFixtures instead of this method. |
59
|
|
|
*/ |
60
|
|
|
private function installExampleData(): void |
61
|
|
|
{ |
62
|
|
|
// insert/get extra ids |
63
|
|
|
$extras = []; |
64
|
|
|
$extras['blog_block'] = $this->insertExtra('Blog', ModuleExtraType::block(), 'Blog'); |
65
|
|
|
$extras['blog_widget_recent_comments'] = $this->insertExtra( |
66
|
|
|
'Blog', |
67
|
|
|
ModuleExtraType::widget(), |
68
|
|
|
'RecentComments', |
69
|
|
|
'RecentComments' |
70
|
|
|
); |
71
|
|
|
$extras['blog_widget_categories'] = $this->insertExtra( |
72
|
|
|
'Blog', |
73
|
|
|
ModuleExtraType::widget(), |
74
|
|
|
'Categories', |
75
|
|
|
'Categories' |
76
|
|
|
); |
77
|
|
|
$extras['blog_widget_archive'] = $this->insertExtra('Blog', ModuleExtraType::widget(), 'Archive', 'Archive'); |
78
|
|
|
$extras['blog_widget_recent_articles_full'] = $this->insertExtra( |
79
|
|
|
'Blog', |
80
|
|
|
ModuleExtraType::widget(), |
81
|
|
|
'RecentArticlesFull', |
82
|
|
|
'RecentArticlesFull' |
83
|
|
|
); |
84
|
|
|
$extras['blog_widget_related_articles'] = $this->insertExtra( |
85
|
|
|
'Blog', |
86
|
|
|
ModuleExtraType::widget(), |
87
|
|
|
'RelatedArticles', |
88
|
|
|
'RelatedArticles' |
89
|
|
|
); |
90
|
|
|
$extras['blog_widget_recent_articles_list'] = $this->insertExtra( |
91
|
|
|
'Blog', |
92
|
|
|
ModuleExtraType::widget(), |
93
|
|
|
'RecentArticlesList', |
94
|
|
|
'RecentArticlesList' |
95
|
|
|
); |
96
|
|
|
if (in_array('Faq', $this->getVariable('selected_modules'))) { |
|
|
|
|
97
|
|
|
$extras['faq_block'] = $this->insertExtra('Faq', ModuleExtraType::block(), 'Faq'); |
98
|
|
|
} |
99
|
|
|
if (in_array('Mailmotor', $this->getVariable('selected_modules'))) { |
100
|
|
|
$extras['mailmotor_subscribe'] = $this->insertExtra( |
101
|
|
|
'Mailmotor', |
102
|
|
|
ModuleExtraType::block(), |
103
|
|
|
'SubscribeForm', |
104
|
|
|
'Subscribe' |
105
|
|
|
); |
106
|
|
|
$extras['mailmotor_unsubscribe'] = $this->insertExtra( |
107
|
|
|
'Mailmotor', |
108
|
|
|
ModuleExtraType::block(), |
109
|
|
|
'UnsubscribeForm', |
110
|
|
|
'Unsubscribe' |
111
|
|
|
); |
112
|
|
|
} |
113
|
|
|
$extras['tags_block'] = $this->insertExtra('Tags', ModuleExtraType::block(), 'Tags'); |
114
|
|
|
if (in_array('Profiles', $this->getVariable('selected_modules'))) { |
115
|
|
|
$extras['profiles_forgot_password'] = $this->insertExtra( |
116
|
|
|
'Profiles', |
117
|
|
|
ModuleExtraType::block(), |
118
|
|
|
'ForgotPassword', |
119
|
|
|
'ForgotPassword' |
120
|
|
|
); |
121
|
|
|
$extras['profiles_block'] = $this->insertExtra( |
122
|
|
|
'Profiles', |
123
|
|
|
ModuleExtraType::block(), |
124
|
|
|
'Dashboard' |
125
|
|
|
); |
126
|
|
|
$extras['profiles_login'] = $this->insertExtra( |
127
|
|
|
'Profiles', |
128
|
|
|
ModuleExtraType::block(), |
129
|
|
|
'Login', |
130
|
|
|
'Login' |
131
|
|
|
); |
132
|
|
|
$extras['profiles_logout'] = $this->insertExtra( |
133
|
|
|
'Profiles', |
134
|
|
|
ModuleExtraType::block(), |
135
|
|
|
'Logout', |
136
|
|
|
'Logout' |
137
|
|
|
); |
138
|
|
|
$extras['profiles_change_email'] = $this->insertExtra( |
139
|
|
|
'Profiles', |
140
|
|
|
ModuleExtraType::block(), |
141
|
|
|
'ChangeEmail', |
142
|
|
|
'ChangeEmail' |
143
|
|
|
); |
144
|
|
|
$extras['profiles_change_password'] = $this->insertExtra( |
145
|
|
|
'Profiles', |
146
|
|
|
ModuleExtraType::block(), |
147
|
|
|
'ChangePassword', |
148
|
|
|
'ChangePassword' |
149
|
|
|
); |
150
|
|
|
$extras['profiles_settings'] = $this->insertExtra( |
151
|
|
|
'Profiles', |
152
|
|
|
ModuleExtraType::block(), |
153
|
|
|
'Settings', |
154
|
|
|
'Settings' |
155
|
|
|
); |
156
|
|
|
$extras['profiles_register'] = $this->insertExtra( |
157
|
|
|
'Profiles', |
158
|
|
|
ModuleExtraType::block(), |
159
|
|
|
'Register', |
160
|
|
|
'Register' |
161
|
|
|
); |
162
|
|
|
$extras['profiles_resend_activation'] = $this->insertExtra( |
163
|
|
|
'Profiles', |
164
|
|
|
ModuleExtraType::block(), |
165
|
|
|
'ResendActivation', |
166
|
|
|
'ResendActivation' |
167
|
|
|
); |
168
|
|
|
$extras['profiles_login_box'] = $this->insertExtra( |
169
|
|
|
'Profiles', |
170
|
|
|
ModuleExtraType::widget(), |
171
|
|
|
'LoginBox', |
172
|
|
|
'LoginBox' |
173
|
|
|
); |
174
|
|
|
$extras['profiles_login_link'] = $this->insertExtra( |
175
|
|
|
'Profiles', |
176
|
|
|
ModuleExtraType::widget(), |
177
|
|
|
'LoginLink', |
178
|
|
|
'LoginLink' |
179
|
|
|
); |
180
|
|
|
$extras['profiles_secure_page'] = $this->insertExtra( |
181
|
|
|
'Profiles', |
182
|
|
|
ModuleExtraType::widget(), |
183
|
|
|
'SecurePage', |
184
|
|
|
'SecurePage' |
185
|
|
|
); |
186
|
|
|
} |
187
|
|
|
|
188
|
|
|
// loop languages |
189
|
|
|
foreach ($this->getLanguages() as $language) { |
190
|
|
|
// insert modules page |
191
|
|
|
$modulesPageId = $this->insertPage( |
192
|
|
|
[ |
193
|
|
|
'id' => 4, |
194
|
|
|
'title' => SpoonFilter::ucfirst( |
195
|
|
|
$this->getLocale('Modules', 'Core', $language, 'lbl', 'Frontend') |
196
|
|
|
), |
197
|
|
|
'type' => 'page', |
198
|
|
|
'language' => $language, |
199
|
|
|
'parent_id' => BackendModel::HOME_PAGE_ID, |
200
|
|
|
], |
201
|
|
|
null, |
202
|
|
|
['extra_id' => $this->getExtraId('subpages')], |
203
|
|
|
['extra_id' => $this->getExtraId('search_form'), 'position' => 'top'] |
204
|
|
|
); |
205
|
|
|
|
206
|
|
|
// check if pages already exist for this language |
207
|
|
|
if (!$this->hasPage($language)) { |
208
|
|
|
// re-insert homepage |
209
|
|
|
$this->insertPage( |
210
|
|
|
[ |
211
|
|
|
'id' => BackendModel::HOME_PAGE_ID, |
212
|
|
|
'parent_id' => BackendPagesModel::NO_PARENT_PAGE_ID, |
213
|
|
|
'template_id' => $this->getTemplateId('home'), |
214
|
|
|
'title' => SpoonFilter::ucfirst($this->getLocale('Home', 'Core', $language)), |
215
|
|
|
'language' => $language, |
216
|
|
|
'allow_move' => false, |
217
|
|
|
'allow_delete' => false, |
218
|
|
|
], |
219
|
|
|
null, |
220
|
|
|
['html' => __DIR__ . '/Data/' . $language . '/sample1.txt'], |
221
|
|
|
['extra_id' => $extras['blog_widget_recent_articles_list'], 'position' => 'main'], |
222
|
|
|
['extra_id' => $extras['blog_widget_recent_comments'], 'position' => 'main'], |
223
|
|
|
['extra_id' => $this->getExtraId('search_form'), 'position' => 'top'] |
224
|
|
|
); |
225
|
|
|
|
226
|
|
|
// blog |
227
|
|
|
$this->insertPage( |
228
|
|
|
[ |
229
|
|
|
'title' => SpoonFilter::ucfirst( |
230
|
|
|
$this->getLocale('Blog', 'Core', $language, 'lbl', 'Frontend') |
231
|
|
|
), |
232
|
|
|
'language' => $language, |
233
|
|
|
'parent_id' => $modulesPageId, |
234
|
|
|
], |
235
|
|
|
null, |
236
|
|
|
['extra_id' => $extras['blog_block']], |
237
|
|
|
['extra_id' => $extras['blog_widget_recent_comments'], 'position' => 'main'], |
238
|
|
|
['extra_id' => $extras['blog_widget_categories'], 'position' => 'main'], |
239
|
|
|
['extra_id' => $extras['blog_widget_archive'], 'position' => 'main'], |
240
|
|
|
['extra_id' => $extras['blog_widget_recent_articles_list'], 'position' => 'main'], |
241
|
|
|
['extra_id' => $this->getExtraId('search_form'), 'position' => 'top'] |
242
|
|
|
); |
243
|
|
|
|
244
|
|
|
// faq |
245
|
|
|
if (in_array('Faq', $this->getVariable('selected_modules'))) { |
246
|
|
|
$this->insertPage( |
247
|
|
|
[ |
248
|
|
|
'title' => 'FAQ', |
249
|
|
|
'language' => $language, |
250
|
|
|
'parent_id' => $modulesPageId, |
251
|
|
|
], |
252
|
|
|
null, |
253
|
|
|
['extra_id' => $extras['faq_block']] |
254
|
|
|
); |
255
|
|
|
} |
256
|
|
|
|
257
|
|
|
// mailmotor |
258
|
|
|
if (in_array('Mailmotor', $this->getVariable('selected_modules'))) { |
259
|
|
|
$newslettersPageId = $this->insertPage( |
260
|
|
|
[ |
261
|
|
|
'title' => 'Newsletters', |
262
|
|
|
'language' => $language, |
263
|
|
|
'parent_id' => $modulesPageId, |
264
|
|
|
] |
265
|
|
|
); |
266
|
|
|
$this->insertPage( |
267
|
|
|
['parent_id' => $newslettersPageId, 'title' => 'Subscribe', 'language' => $language], |
268
|
|
|
null, |
269
|
|
|
['extra_id' => $extras['mailmotor_subscribe'], 'position' => 'main'] |
270
|
|
|
); |
271
|
|
|
$this->insertPage( |
272
|
|
|
['parent_id' => $newslettersPageId, 'title' => 'Unsubscribe', 'language' => $language], |
273
|
|
|
null, |
274
|
|
|
['extra_id' => $extras['mailmotor_unsubscribe'], 'position' => 'main'] |
275
|
|
|
); |
276
|
|
|
} |
277
|
|
|
|
278
|
|
|
// tags |
279
|
|
|
$this->insertPage( |
280
|
|
|
[ |
281
|
|
|
'title' => 'Tags', |
282
|
|
|
'language' => $language, |
283
|
|
|
'parent_id' => $modulesPageId, |
284
|
|
|
], |
285
|
|
|
null, |
286
|
|
|
['extra_id' => $extras['tags_block'], 'position' => 'main'], |
287
|
|
|
['extra_id' => $this->getExtraId('search_form'), 'position' => 'top'] |
288
|
|
|
); |
289
|
|
|
|
290
|
|
|
// profiles |
291
|
|
|
if (in_array('Profiles', $this->getVariable('selected_modules'))) { |
292
|
|
|
$profilesPageId = $this->insertPage( |
293
|
|
|
[ |
294
|
|
|
'title' => 'Profiles', |
295
|
|
|
'language' => $language, |
296
|
|
|
'parent_id' => $modulesPageId, |
297
|
|
|
], |
298
|
|
|
null, |
299
|
|
|
['extra_id' => $this->getExtraId('subpages')], |
300
|
|
|
['extra_id' => $this->getExtraId('search_form'), 'position' => 'top'] |
301
|
|
|
); |
302
|
|
|
$this->insertPage( |
303
|
|
|
[ |
304
|
|
|
'title' => SpoonFilter::ucfirst($this->getLocale('ForgotPassword', 'Core', $language, 'lbl', 'Backend')), |
305
|
|
|
'language' => $language, |
306
|
|
|
'parent_id' => $profilesPageId, |
307
|
|
|
], |
308
|
|
|
null, |
309
|
|
|
['extra_id' => $extras['profiles_forgot_password'], 'position' => 'main'], |
310
|
|
|
['extra_id' => $this->getExtraId('search_form'), 'position' => 'top'] |
311
|
|
|
); |
312
|
|
|
$this->insertPage( |
313
|
|
|
[ |
314
|
|
|
'title' => SpoonFilter::ucfirst( |
315
|
|
|
$this->getLocale('ResendActivation', 'Core', $language, 'lbl', 'Backend') |
316
|
|
|
), |
317
|
|
|
'language' => $language, |
318
|
|
|
'parent_id' => $profilesPageId, |
319
|
|
|
], |
320
|
|
|
null, |
321
|
|
|
['extra_id' => $extras['profiles_resend_activation'], 'position' => 'main'], |
322
|
|
|
['extra_id' => $this->getExtraId('search_form'), 'position' => 'top'] |
323
|
|
|
); |
324
|
|
|
$this->insertPage( |
325
|
|
|
[ |
326
|
|
|
'title' => SpoonFilter::ucfirst($this->getLocale('Login', 'Core', $language, 'lbl', 'Backend')), |
327
|
|
|
'language' => $language, |
328
|
|
|
'parent_id' => $profilesPageId, |
329
|
|
|
], |
330
|
|
|
null, |
331
|
|
|
['extra_id' => $extras['profiles_login'], 'position' => 'main'], |
332
|
|
|
['extra_id' => $this->getExtraId('search_form'), 'position' => 'top'] |
333
|
|
|
); |
334
|
|
|
$this->insertPage( |
335
|
|
|
[ |
336
|
|
|
'title' => SpoonFilter::ucfirst($this->getLocale('Register', 'Core', $language, 'lbl', 'Backend')), |
337
|
|
|
'language' => $language, |
338
|
|
|
'parent_id' => $profilesPageId, |
339
|
|
|
], |
340
|
|
|
null, |
341
|
|
|
['extra_id' => $extras['profiles_register'], 'position' => 'main'], |
342
|
|
|
['extra_id' => $this->getExtraId('search_form'), 'position' => 'top'] |
343
|
|
|
); |
344
|
|
|
$this->insertPage( |
345
|
|
|
[ |
346
|
|
|
'title' => SpoonFilter::ucfirst($this->getLocale('Logout', 'Core', $language, 'lbl', 'Backend')), |
347
|
|
|
'language' => $language, |
348
|
|
|
'parent_id' => $profilesPageId, |
349
|
|
|
], |
350
|
|
|
null, |
351
|
|
|
['extra_id' => $extras['profiles_logout'], 'position' => 'main'], |
352
|
|
|
['extra_id' => $this->getExtraId('search_form'), 'position' => 'top'] |
353
|
|
|
); |
354
|
|
|
$this->insertPage( |
355
|
|
|
[ |
356
|
|
|
'title' => SpoonFilter::ucfirst($this->getLocale('Profile', 'Core', $language, 'lbl', 'Backend')), |
357
|
|
|
'language' => $language, |
358
|
|
|
'parent_id' => $profilesPageId, |
359
|
|
|
], |
360
|
|
|
null, |
361
|
|
|
['extra_id' => $extras['profiles_block'], 'position' => 'main'], |
362
|
|
|
['extra_id' => $this->getExtraId('search_form'), 'position' => 'top'] |
363
|
|
|
); |
364
|
|
|
$this->insertPage( |
365
|
|
|
[ |
366
|
|
|
'title' => SpoonFilter::ucfirst( |
367
|
|
|
$this->getLocale('ProfileSettings', 'Core', $language, 'lbl', 'Backend') |
368
|
|
|
), |
369
|
|
|
'language' => $language, |
370
|
|
|
'parent_id' => $profilesPageId, |
371
|
|
|
], |
372
|
|
|
null, |
373
|
|
|
['extra_id' => $extras['profiles_settings'], 'position' => 'main'], |
374
|
|
|
['extra_id' => $this->getExtraId('search_form'), 'position' => 'top'] |
375
|
|
|
); |
376
|
|
|
$this->insertPage( |
377
|
|
|
[ |
378
|
|
|
'title' => SpoonFilter::ucfirst($this->getLocale('ChangeEmail', 'Core', $language, 'lbl', 'Backend')), |
379
|
|
|
'language' => $language, |
380
|
|
|
'parent_id' => $profilesPageId, |
381
|
|
|
], |
382
|
|
|
null, |
383
|
|
|
['extra_id' => $extras['profiles_change_email'], 'position' => 'main'], |
384
|
|
|
['extra_id' => $this->getExtraId('search_form'), 'position' => 'top'] |
385
|
|
|
); |
386
|
|
|
$this->insertPage( |
387
|
|
|
[ |
388
|
|
|
'title' => SpoonFilter::ucfirst($this->getLocale('ChangePassword', 'Core', $language, 'lbl', 'Backend')), |
389
|
|
|
'language' => $language, |
390
|
|
|
'parent_id' => $profilesPageId, |
391
|
|
|
], |
392
|
|
|
null, |
393
|
|
|
['extra_id' => $extras['profiles_change_password'], 'position' => 'main'], |
394
|
|
|
['extra_id' => $this->getExtraId('search_form'), 'position' => 'top'] |
395
|
|
|
); |
396
|
|
|
} |
397
|
|
|
} |
398
|
|
|
} |
399
|
|
|
} |
400
|
|
|
|
401
|
|
|
private function configureFrontendExtras(): void |
402
|
|
|
{ |
403
|
|
|
$this->extraIds['search'] = $this->insertExtra('Search', ModuleExtraType::block(), 'Search'); |
404
|
|
|
$this->extraIds['search_form'] = $this->insertExtra('Search', ModuleExtraType::widget(), 'SearchForm', 'Form'); |
405
|
|
|
$this->extraIds['sitemap'] = $this->insertExtra($this->getModule(), ModuleExtraType::widget(), 'Sitemap', 'Sitemap'); |
406
|
|
|
$this->extraIds['subpages'] = $this->insertExtra( |
407
|
|
|
$this->getModule(), |
408
|
|
|
ModuleExtraType::widget(), |
409
|
|
|
'Subpages', |
410
|
|
|
'Subpages', |
411
|
|
|
['template' => 'SubpagesDefault.html.twig'] |
412
|
|
|
); |
413
|
|
|
$this->insertExtra($this->getModule(), ModuleExtraType::widget(), 'Navigation', 'PreviousNextNavigation'); |
414
|
|
|
} |
415
|
|
|
|
416
|
|
|
private function configureFrontendPages(): void |
417
|
|
|
{ |
418
|
|
|
// loop languages |
419
|
|
|
foreach ($this->getLanguages() as $language) { |
420
|
|
|
// check if pages already exist for this language |
421
|
|
|
if ($this->hasPage($language)) { |
422
|
|
|
continue; |
423
|
|
|
} |
424
|
|
|
|
425
|
|
|
// insert homepage |
426
|
|
|
$this->insertPage( |
427
|
|
|
[ |
428
|
|
|
'id' => BackendModel::HOME_PAGE_ID, |
429
|
|
|
'parent_id' => BackendPagesModel::NO_PARENT_PAGE_ID, |
430
|
|
|
'template_id' => $this->getTemplateId('home'), |
431
|
|
|
'title' => SpoonFilter::ucfirst($this->getLocale('Home', 'Core', $language, 'lbl', 'Backend')), |
432
|
|
|
'language' => $language, |
433
|
|
|
'allow_move' => false, |
434
|
|
|
'allow_delete' => false, |
435
|
|
|
], |
436
|
|
|
null, |
437
|
|
|
['html' => __DIR__ . '/Data/' . $language . '/sample1.txt'], |
438
|
|
|
['extra_id' => $this->getExtraId('search_form'), 'position' => 'top'] |
439
|
|
|
); |
440
|
|
|
|
441
|
|
|
// insert sitemap |
442
|
|
|
$this->insertPage( |
443
|
|
|
[ |
444
|
|
|
'id' => 2, |
445
|
|
|
'title' => SpoonFilter::ucfirst( |
446
|
|
|
$this->getLocale('Sitemap', 'Core', $language, 'lbl', 'Frontend') |
447
|
|
|
), |
448
|
|
|
'type' => 'footer', |
449
|
|
|
'language' => $language, |
450
|
|
|
], |
451
|
|
|
null, |
452
|
|
|
['html' => __DIR__ . '/Data/' . $language . '/sitemap.txt'], |
453
|
|
|
['extra_id' => $this->getExtraId('sitemap')], |
454
|
|
|
['extra_id' => $this->getExtraId('search_form'), 'position' => 'top'] |
455
|
|
|
); |
456
|
|
|
|
457
|
|
|
// insert disclaimer |
458
|
|
|
$this->insertPage( |
459
|
|
|
[ |
460
|
|
|
'id' => 3, |
461
|
|
|
'title' => SpoonFilter::ucfirst( |
462
|
|
|
$this->getLocale('Disclaimer', 'Core', $language, 'lbl', 'Frontend') |
463
|
|
|
), |
464
|
|
|
'type' => 'footer', |
465
|
|
|
'language' => $language, |
466
|
|
|
], |
467
|
|
|
['seo_index' => 'noindex', 'seo_follow' => 'nofollow'], |
468
|
|
|
[ |
469
|
|
|
'html' => __DIR__ . '/Data/' . $language . |
470
|
|
|
'/disclaimer.txt', |
471
|
|
|
], |
472
|
|
|
['extra_id' => $this->getExtraId('search_form'), 'position' => 'top'] |
473
|
|
|
); |
474
|
|
|
|
475
|
|
|
// insert 404 |
476
|
|
|
$this->insertPage( |
477
|
|
|
[ |
478
|
|
|
'id' => BackendModel::ERROR_PAGE_ID, |
479
|
|
|
'title' => '404', |
480
|
|
|
'template_id' => $this->getTemplateId('error'), |
481
|
|
|
'type' => 'root', |
482
|
|
|
'language' => $language, |
483
|
|
|
'allow_move' => false, |
484
|
|
|
'allow_delete' => false, |
485
|
|
|
], |
486
|
|
|
null, |
487
|
|
|
['html' => __DIR__ . '/Data/' . $language . '/404.txt'], |
488
|
|
|
['extra_id' => $this->getExtraId('sitemap')], |
489
|
|
|
['extra_id' => $this->getExtraId('search_form'), 'position' => 'top'] |
490
|
|
|
); |
491
|
|
|
} |
492
|
|
|
|
493
|
|
|
// install example data if requested |
494
|
|
|
if ($this->installExample()) { |
495
|
|
|
$this->installExampleData(); |
496
|
|
|
} |
497
|
|
|
} |
498
|
|
|
|
499
|
|
|
private function getExtraId(string $key): int |
500
|
|
|
{ |
501
|
|
|
if (!array_key_exists($key, $this->extraIds)) { |
502
|
|
|
throw new \Exception('Key not set yet, please check your installer.'); |
503
|
|
|
} |
504
|
|
|
|
505
|
|
|
return $this->extraIds[$key]; |
506
|
|
|
} |
507
|
|
|
|
508
|
|
|
private function hasPage(string $language): bool |
509
|
|
|
{ |
510
|
|
|
// @todo: Replace with PageRepository method when it exists. |
511
|
|
|
return (bool) $this->getDatabase()->getVar( |
512
|
|
|
'SELECT 1 FROM pages WHERE language = ? AND id > ? LIMIT 1', |
513
|
|
|
[$language, BackendModel::ERROR_PAGE_ID] |
514
|
|
|
); |
515
|
|
|
} |
516
|
|
|
} |
517
|
|
|
|