-
Notifications
You must be signed in to change notification settings - Fork 0
/
falcon.install
56 lines (49 loc) · 1.79 KB
/
falcon.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
<?php
/**
* @file
* Install/uninstall functions for Falcon profile.
*/
/**
* Execute code after install profile.
*/
function falcon_install() {
// Creating list of default custom features which should be enabled.
// Custom features don't have dependency on 'Features' module so we should
// enable custom features after installing 'Features' module because
// it solves an issue with configuration conflicts.
// We can add dependency on 'features' module into every custom feature and
// then we can add custom features to falcon.info.yml.
$FEATURES_DEFAULT_ENABLED = [
'falcon_feature_appeal',
'falcon_feature_commerce',
'falcon_feature_commerce_direct_debit_gateway',
'falcon_feature_demo',
'falcon_feature_donation',
'falcon_feature_mail',
'falcon_feature_metatag',
'falcon_feature_text_format',
'falcon_feature_user',
'falcon_feature_xml_sitemap',
];
$module_installer = \Drupal::service('module_installer');
// Enable default custom features.
$module_installer->install($FEATURES_DEFAULT_ENABLED);
// Create a new default consumer.
$consumer = \Drupal::entityTypeManager()->getStorage('consumer')->create([
'uuid' => '114e3e1a-6f65-49a8-9a24-v0043fabd6e7',
'type' => 'consumer',
'label' => 'Falcon',
'is_default' => TRUE,
'image_styles' => [['target_id' => 'full_size']]
]);
$consumer->save();
// Delete the old consumer created by Consumers module upon installation.
/* @var $consumers \Drupal\Core\Entity\ContentEntityInterface[] */
$consumers = \Drupal::entityTypeManager()
->getStorage('consumer')
->loadByProperties(['label' => 'Default Consumer']);
$default_consumer = array_shift($consumers);
$default_consumer->delete();
// Add demo content.
$module_installer->install(['falcon_demo_content']);
}