This repository has been archived by the owner on Jan 28, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathod.install
88 lines (78 loc) · 2.17 KB
/
od.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
<?php
/**
* @file
* Install and uninstall functions for the Open Data installation profile.
*/
/**
* Implements hook_install().
*
* Perform actions to set up the site for this profile.
*
* @see system_install()
*/
function od_install() {
_od_setup_themes();
_od_setup_branding();
_od_setup_base_configurations();
}
/**
* Setup base site configurations.
*/
function _od_setup_base_configurations() {
$config = \Drupal::service('config.factory')->getEditable('system.site');
$config->set('name', 'Open Government')
->set('mail', '[email protected]')
->save();
$config = \Drupal::languageManager()->getLanguageConfigOverride('fr', 'system.site');
$config->set('name', 'Gouvernement ouvert')
->save();
// Set regional settings to be Country: Canada, TZ: America/Toronto, etc.
\Drupal::service('config.factory')
->getEditable('system.date')
->set('country.default', 'CA')
->set('timezone.default', 'America/Toronto')
->set('timezone.user.configurable', TRUE)
->set('timezone.user.warn', FALSE)
->set('timezone.user.default', 0)
->save(TRUE);
// Ensure the translation fields are created in the database.
\Drupal::service('entity.definition_update_manager')->applyUpdates();
}
/**
* Set up the default branding.
*/
function _od_setup_branding() {
// Set the path to the logo, favicon and README file based on install
// directory.
$od_path = drupal_get_path('profile', 'od');
\Drupal::configFactory()
->getEditable('system.theme.global')
->set('logo', [
'path' => $od_path . '/od.svg',
'url' => '',
'use_default' => FALSE,
])
->set('favicon', [
'mimetype' => 'image/vnd.microsoft.icon',
'path' => $od_path . '/favicon.ico',
'url' => '',
'use_default' => FALSE,
])
->save(TRUE);
}
/**
* Setup the themes.
*/
function _od_setup_themes() {
// Set the default and admin theme.
\Drupal::configFactory()
->getEditable('system.theme')
->set('default', 'od_bootstrap')
->set('admin', 'seven')
->save(TRUE);
// Enable the admin theme.
\Drupal::configFactory()
->getEditable('node.settings')
->set('use_admin_theme', TRUE)
->save(TRUE);
}