This repository has been archived by the owner on Nov 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 102
/
lightning.install
123 lines (109 loc) · 3.19 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
118
119
120
121
122
123
<?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.
*/
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() {
/*
* This ancient line is disabled in order to evade a strict coding standards
* check. It should not be necessary at this point anyway, since it dates from
* the days of Lightning 1.x, which has long since been end-of-life.
*
* eval('interface Drupal\entity\Entity\RevisionableEntityBundleInterface{}');
*/
Drupal::service('module_installer')->install(['entity']);
}
/**
* Removed in Lightning 8.x-2.04.
*
* Formerly installed Contact Storage.
*/
function lightning_update_8005() {
}
/**
* Removed in Lightning 8.x-2.04.
*
* Formerly Granted permission to use contact form(s).
*/
function lightning_update_8006() {
}
/**
* Uninstalls the lightning_install module.
*/
function lightning_update_8007() {
Drupal::service('module_installer')->uninstall(['lightning_install']);
}
/**
* Installs the profile_switcher module.
*/
function lightning_update_8008() {
Drupal::service('module_installer')->install(['profile_switcher']);
}
/**
* Implements hook_update_dependencies().
*/
function lightning_update_dependencies() {
return [
'media_entity' => [
// Lightning 8004 must run before Media Entity 8002.
8002 => [
'lightning' => 8004,
],
],
];
}