forked from acquia/lightning
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lightning.install
117 lines (105 loc) · 2.93 KB
/
lightning.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?php
/**
* @file
* Install and uninstall functions for the Lightning installation profile.
*/
use Drupal\Core\Entity\Entity\EntityViewDisplay;
use Drupal\field\Entity\FieldConfig;
use Drupal\lightning_core\ConfigHelper as Config;
/**
* Makes updates to some basic config that ships with Lightning.
*
* Install the body field on the basic block_content type, delete the Create
* landing page shortcut, and uninstall the Media Demo Content Module.
*/
function lightning_update_8001() {
// Install the body field on the basic block_content type.
$field = FieldConfig::load('block_content.basic.body');
if (empty($field)) {
$config = Config::forModule('lightning');
$config->getEntity('field_config', 'block_content.basic.body')->save();
$display = EntityViewDisplay::load('block_content.basic.default');
if ($display) {
/** @var \Drupal\Core\Entity\Display\EntityViewDisplayInterface $display */
$display->setComponent('body', [
'type' => 'text_default',
'weight' => 0,
'label' => 'hidden',
'settings' => [],
'third_party_settings' => [],
])->save();
}
else {
$config->getEntity('entity_view_display', 'block_content.basic.default')->save();
}
}
// Delete the `Create Landing Page` toolbar shortcut.
$properties = ['link__uri' => 'internal:/admin/structure/landing-page'];
$shortcuts = \Drupal::entityTypeManager()->getStorage('shortcut')->loadByProperties($properties);
foreach ($shortcuts as $shortcut) {
$shortcut->delete();
}
// Uninstall the Media Demo Content module.
\Drupal::service('module_installer')->uninstall(['lightning_media_democontent']);
}
/**
* Removed in Lightning 8.x-2.06.
*
* Formerly created roles for editing content types.
*
* @deprecated
*/
function lightning_update_8002() {
}
/**
* Enables the lightning_core module.
*/
function lightning_update_8003() {
\Drupal::service('module_installer')->install(['lightning_core']);
}
/**
* Enables Entity API.
*/
function lightning_update_8004() {
require_once __DIR__ . '/.entity-helper.php';
\Drupal::service('module_installer')->install(['entity']);
}
/**
* Removed in Lightning 8.x-2.04.
*
* Formerly installed Contact Storage.
*
* @deprecated
*/
function lightning_update_8005() {
}
/**
* Removed in Lightning 8.x-2.04.
*
* Formerly Granted permission to use contact form(s).
*
* @deprecated
*/
function lightning_update_8006() {
}
/**
* Implements hook_update_dependencies().
*/
function lightning_update_dependencies() {
return [
'lightning_dev' => [
// Lightning Dev 8010 invokes hook_modules_installed() on all modules, so
// Lightning API must ensure the correct OpenAPI modules are installed
// before that happens.
8010 => [
'lightning_api' => 8300,
],
],
'media_entity' => [
// Lightning 8004 must run before Media Entity 8002.
8002 => [
'lightning' => 8004,
],
],
];
}