-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathos2web_hjemmeside.install
54 lines (47 loc) · 1.39 KB
/
os2web_hjemmeside.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
<?php
/**
* @file
* Install, uninstall and update hooks for os2web_hjemmeside module.
*/
use Symfony\Component\Yaml\Yaml;
/**
* Reads in new configuration.
*
* @param string $config_name
* Configuration name.
*/
function os2web_hjemmeside_read_in_new_config($config_name) {
$path = drupal_get_path('module', 'os2web_hjemmeside');
/** @var \Drupal\Core\Config\StorageInterface $active_storage */
$active_storage = \Drupal::service('config.storage');
$active_storage->write($config_name, Yaml::parse(file_get_contents($path . '/config/optional/' . $config_name . '.yml')));
}
/**
* Implements hook_install().
*/
function os2web_hjemmeside_install() {
// Update admin/content view.
Drupal::configFactory()->getEditable('views.view.content')->delete();
os2web_hjemmeside_read_in_new_config('views.view.content');
}
/**
* Implements hook_update_N().
*
* Install new required module textfield_counter.
*/
function os2web_hjemmeside_update_8901() {
\Drupal::service('module_installer')->install(['textfield_counter']);
}
/**
* Install new contrib module save_edit.
*/
function os2web_hjemmeside_update_8902() {
\Drupal::service('module_installer')->install(['save_edit']);
}
/**
* Add Editor and Webmaster roles.
*/
function os2web_hjemmeside_update_8903() {
os2web_hjemmeside_read_in_new_config('user.role.editor');
os2web_hjemmeside_read_in_new_config('user.role.webmaster');
}