-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathgovcms.install
More file actions
60 lines (53 loc) · 1.45 KB
/
govcms.install
File metadata and controls
60 lines (53 loc) · 1.45 KB
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
<?php
/**
* @file
* Install, update and uninstall functions for the GovCMS installation profile.
*/
use Drupal\shortcut\Entity\Shortcut;
use Drupal\menu_link_content\Entity\MenuLinkContent;
// GovCMS update hooks.
include_once __DIR__ . '/includes/govcms.update.inc';
/**
* Implements hook_install().
*
* Sets up the GovCMS profile during installation.
*
* @see system_install()
*/
function govcms_install() {
// Create default shortcut for adding content.
Shortcut::create([
'shortcut_set' => 'default',
'title' => t('Add content'),
'weight' => 1,
'link' => ['uri' => 'internal:/node/add'],
])->save();
// Skip further actions during config sync.
if (\Drupal::isConfigSyncing()) {
return;
}
// Set paths for the logo, favicon, and README file based on install directory.
$govcmsPath = \Drupal::service('extension.list.profile')->getPath('govcms');
\Drupal::configFactory()
->getEditable('system.theme.global')
->set('logo', [
'path' => $govcmsPath . '/logo.svg',
'url' => '',
'use_default' => TRUE,
])
->set('favicon', [
'mimetype' => 'image/vnd.microsoft.icon',
'path' => $govcmsPath . '/favicon.ico',
'url' => '',
'use_default' => FALSE,
])
->save(TRUE);
\Drupal::configFactory()
->getEditable('olivero.settings')
->set('favicon', [
'use_default' => FALSE,
])
->save(TRUE);
// Grant default permissions.
govcms_default_permissions();
}