forked from ymcatwincities/openy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopeny.install
346 lines (302 loc) · 8.56 KB
/
openy.install
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
<?php
/**
* @file
* Install and uninstall functions for the OpenY installation profile.
*/
/**
* Implements hook_install().
*
* Performs actions to set up the site for this profile.
*
* @see system_install()
*/
function openy_install() {
$config_factory = Drupal::configFactory();
$module_installer = Drupal::service('module_installer');
// Set the default and admin theme.
$config_factory
->getEditable('system.theme')
->set('default', 'openy_rose')
->set('admin', 'seven')
->save(TRUE);
// Enable the admin theme.
$config_factory
->getEditable('node.settings')
->set('use_admin_theme', TRUE)
->save(TRUE);
// Enable openy_upgrade_tool.
$module_installer->install(['openy_upgrade_tool'], TRUE);
// Enable openy_user after all modules are installed.
$module_installer->install(['openy_user'], TRUE);
// Enable openy_node_alert after openy_rose theme is enabled to place blocks.
$module_installer->install(['openy_node_alert'], TRUE);
}
/**
* Upgrade from 8.x-0.2 version.
*/
function openy_update_8001() {
if (\Drupal::service('module_handler')->moduleExists('openy_migrate')) {
// Enable modules.
\Drupal::service('module_installer')->install([
'openy_demo_ncamp',
], TRUE);
// Run openy_demo_ncamp migration.
$importer = \Drupal::service('openy_migrate.importer');
$importer->import('openy_demo_node_camp');
$importer->import('openy_demo_node_landing');
}
}
/**
* Enable Alerts.
*/
function openy_update_8002() {
if (\Drupal::service('module_handler')->moduleExists('openy_node_alert')) {
return;
}
// Enable module.
\Drupal::service('module_installer')->install(['openy_node_alert']);
}
/**
* Enable config_import module.
*/
function openy_update_8003() {
// Enable module.
\Drupal::service('module_installer')->install([
'config_import',
'logger_entity',
'openy_upgrade_tool',
]);
}
/**
* Fix tour config dependencies.
*/
function openy_update_8004() {
$config = drupal_get_path('theme', 'openy_rose') . '/config/optional/tour.tour.openy-theme-overview.yml';
$config_importer = \Drupal::service('openy_upgrade_tool.param_updater');
$config_importer->update($config, 'tour.tour.openy-theme-overview', 'dependencies');
}
/**
* Enable Data layer modules & revert needed configuration.
*/
function openy_update_8005() {
// Enable module.
\Drupal::service('module_installer')->install(
['libraries', 'datalayer', 'openy_datalayer']
);
}
/**
* Enable and import demo Facilities.
*/
function openy_update_8006() {
if (\Drupal::service('module_handler')->moduleExists('openy_migrate')) {
// Enable modules.
\Drupal::service('module_installer')->install([
'openy_demo_nfacility',
], TRUE);
// Run openy_demo_nfacility migration.
$importer = \Drupal::service('openy_migrate.importer');
$importer->import('openy_demo_node_facility');
}
}
/**
* Enable Optimizely module.
*/
function openy_update_8007() {
// Enable module.
\Drupal::service('module_installer')->install(['optimizely']);
}
/**
* Add user and main menu blocks to sidebar region.
*/
function openy_update_8008() {
$config_dir = drupal_get_path('profile', 'openy') . '/config/optional';
$config_importer = \Drupal::service('openy_upgrade_tool.importer');
$config_importer->setDirectory($config_dir);
$config_importer->importConfigs([
'block.block.mainnavigation',
'block.block.useraccountmenu',
]);
}
/**
* Add Demo alerts.
*/
function openy_update_8009() {
if (\Drupal::service('module_handler')->moduleExists('openy_migrate')) {
// Enable module.
\Drupal::service('module_installer')->install([
'openy_demo_nalert',
], TRUE);
// Run openy_demo_node_alert migration.
$importer = \Drupal::service('openy_migrate.importer');
$importer->import('openy_demo_node_alert');
}
}
/**
* Enable and import demo Membership content and Demo Join page.
*/
function openy_update_8010() {
// Enable module.
\Drupal::service('module_installer')->install([
'openy_demo_nmbrshp',
], TRUE);
// Run openy_demo_node_landing & openy_demo_node_membership migrations.
$importer = \Drupal::service('openy_migrate.importer');
$importer->import('openy_demo_node_landing');
$importer->import('openy_demo_node_membership');
}
/**
* Enable Google Analytics module.
*/
function openy_update_8011() {
// Enable module.
\Drupal::service('module_installer')->install(['google_analytics']);
}
/**
* Enable Metatag, Redirect and Simple Sitemap modules.
*/
function openy_update_8012() {
// Enable module.
\Drupal::service('module_installer')->install([
'metatag',
'redirect',
'simple_sitemap'
]);
// Set the frontpage to be canonical url instead of alias. We expect node to be there.
$config_factory = Drupal::configFactory();
$url = $config_factory->getEditable('system.site')->get('page.front');
if (strpos($url, 'node/') !== FALSE) {
return;
}
$aliasStorage = \Drupal::service('path.alias_storage');
$alias = $aliasStorage->load(['alias' => $url]);
if (!empty($alias) && strpos($alias['source'], '/node/') !== FALSE) {
$config_factory->getEditable('system.site')->set('page.front', $alias['source'])->save();
$aliasStorage->delete(['alias' => $url]);
}
}
/**
* Enable the Header Footer Template module.
*/
function openy_update_8013() {
// Enable module.
\Drupal::service('module_installer')->install(['openy_hf']);
}
/**
* Update WYSIWYG media buttons.
*/
function openy_update_8014() {
$config = drupal_get_path('profile', 'openy') . '/config/install/editor.editor.full_html.yml';
$config_importer = \Drupal::service('openy_upgrade_tool.param_updater');
$config_importer->update($config, 'editor.editor.full_html', 'settings.toolbar');
}
/**
* Enable OpenY Session Instance & OpenY Moderation wrapper.
*/
function openy_update_8015() {
// Enable module.
\Drupal::service('module_installer')->install([
'openy_moderation_wrapper',
'openy_session_instance',
'openy_schedules',
'openy_prgf_schedule_search'
]);
}
/**
* Enable OpenY paragraph Embedded GroupEx Pro Schedule module.
*/
function openy_update_8016() {
\Drupal::service('module_installer')->install(['openy_prgf_embedded_groupexpro_schedule']);
}
/**
* Enable rabbit hole and rabbit hole node modules.
*/
function openy_update_8017() {
// Enable modules.
\Drupal::service('module_installer')->install([
'rabbit_hole',
'rh_node',
]);
}
/**
* Enable the Class Location paragraph module.
*/
function openy_update_8018() {
// Enable module.
\Drupal::service('module_installer')->install(['openy_prgf_class_location']);
}
/**
* Enable the Class Sessions paragraph module.
*/
function openy_update_8019() {
// Enable module.
\Drupal::service('module_installer')->install(['openy_prgf_class_sessions']);
}
/**
* Enable OpenY Branch Selector module.
*/
function openy_update_8020() {
// Enable module.
\Drupal::service('module_installer')->install(['openy_branch_selector']);
}
/**
* Fix typos in theme settings.
*/
function openy_update_8021() {
// Get config data.
$config = \Drupal::configFactory()->getEditable('openy_rose.settings');
$data = $config->get('oepny_rose_image_fields');
// Update config data.
$config->clear('oepny_rose_image_fields');
$config->set('openy_rose_image_fields', $data);
$config->save();
}
/**
* Enable Webforms set of modules.
*/
function openy_update_8022() {
// Enable module.
\Drupal::service('module_installer')->install([
'webform',
'webform_ui',
'captcha',
'image_captcha',
'recaptcha',
'openy_prgf_webform',
]);
}
/**
* Enable modules: OpenY Popups, OpenY Paragraph Branches Popup (All), and OpenY Paragraph Branches Popup (Class).
*/
function openy_update_8023() {
// Enable module.
\Drupal::service('module_installer')->install([
'openy_popups',
'openy_prgf_branches_popup_all',
'openy_prgf_branches_popup_class'
]);
}
/**
* Enable the Admin Toolbar module.
*/
function openy_update_8024() {
// Enable module.
\Drupal::service('module_installer')->install(['admin_toolbar']);
}
/**
* Enable scheduler module.
*/
function openy_update_8025() {
\Drupal::service('module_installer')->install(['scheduler']);
}
/**
* Enable Colorbutton module.
*/
function openy_update_8026() {
// Enable module.
\Drupal::service('module_installer')->install([
'colorbutton',
]);
$config = drupal_get_path('profile', 'openy') . '/config/install/editor.editor.full_html.yml';
$config_importer = \Drupal::service('openy_upgrade_tool.param_updater');
$config_importer->update($config, 'editor.editor.full_html', 'settings.toolbar');
}