-
Notifications
You must be signed in to change notification settings - Fork 4
/
minimis.install
92 lines (79 loc) · 2.03 KB
/
minimis.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
<?php
/**
* @file
* The Minimis Install File.
*/
/**
* Implements hook_install().
*
* Performs actions to set up the site for this profile.
*
* @see system_install()
*/
function minimis_install() {
global $config_directories;
$sync_directory = '../config/sync';
// Update settings.php.
$settings['settings']['config_sync_directory'] = (object) [
'value' => $sync_directory,
'required' => TRUE,
];
// Rewrite this so it changes it on install.
drupal_rewrite_settings($settings);
$config_directories['sync'] = $sync_directory;
drupal_flush_all_caches();
}
/**
* Implements hook_site_install_finished().
*
* @see https://www.drupal.org/project/drupal/issues/2924549
*/
function minimis_site_install_finished($install_state) {
if (!empty($install_state['parameters']['profile'])) {
$profile = $install_state['parameters']['profile'];
if ($profile === 'minimis') {
drupal_flush_all_caches();
}
}
}
/**
* Implements hook_install_tasks().
*/
function minimis_install_tasks(&$install_state) {
$tasks = [
'minimis_themes_setup' => [
'display_name' => t('Setup Admin & Default Themes'),
'display' => TRUE,
],
];
return $tasks;
}
/**
* Install the admin & default theme.
*
* @param array $install_state
* The install state.
*/
function minimis_themes_setup(array &$install_state) {
// Set the admin theme.
\Drupal::configFactory()
->getEditable('system.theme')
->set('admin', 'adminimal_theme')
->save();
// Set the admin theme for edit and adding content.
\Drupal::configFactory()
->getEditable('node.settings')
->set('use_admin_theme', TRUE)
->save();
// Set the default theme to bootstrap_barrio.
\Drupal::configFactory()
->getEditable('system.theme')
->set('default', 'bootstrap_barrio')
->save();
// Set the default library in bootstrap_barrio to production.
// library that is in root libraries folder.
\Drupal::configFactory()
->getEditable('bootstrap_barrio.settings')
->set('bootstrap_barrio_library', 'production')
->save();
}