-
Notifications
You must be signed in to change notification settings - Fork 0
/
header_and_footer_scripts.install
62 lines (59 loc) · 1.86 KB
/
header_and_footer_scripts.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
<?php
/**
* @file
* Uninstall functions for header_and_footer_scripts module.
*/
/**
* Implements hook_uninstall().
*/
function header_and_footer_scripts_uninstall() {
\Drupal::service('config.factory')
->getEditable('header_and_footer_scripts.header.settings')
->delete();
\Drupal::service('config.factory')
->getEditable('header_and_footer_scripts.body.settings')
->delete();
\Drupal::service('config.factory')
->getEditable('header_and_footer_scripts.footer.settings')
->delete();
}
/**
* Implements hook_update_N().
*
* Adding new configuration variables and updating current configuration
* in it to avoid conflict with any other module.
*/
function header_and_footer_scripts_update_8201() {
$body_section = \Drupal::config('hfs_body_scripts.settings')->get();
$footer_section = \Drupal::config('hfs_footer_scripts.settings')->get();
if (isset($body_section['styles'])) {
\Drupal::configFactory()
->getEditable('header_and_footer_scripts.body.settings')
->set('styles', $body_section['styles'])
->save();
}
if (isset($body_section['scripts'])) {
\Drupal::configFactory()
->getEditable('header_and_footer_scripts.body.settings')
->set('scripts', $body_section['scripts'])
->save();
}
\Drupal::service('config.factory')
->getEditable('hfs_body_scripts.settings')
->delete();
if (isset($footer_section['styles'])) {
\Drupal::configFactory()
->getEditable('header_and_footer_scripts.footer.settings')
->set('styles', $footer_section['styles'])
->save();
}
if (isset($footer_section['scripts'])) {
\Drupal::configFactory()
->getEditable('header_and_footer_scripts.footer.settings')
->set('scripts', $footer_section['scripts'])
->save();
}
\Drupal::service('config.factory')
->getEditable('hfs_footer_scripts.settings')
->delete();
}