-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathvarbase_blog.install
46 lines (36 loc) · 1.49 KB
/
varbase_blog.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
<?php
/**
* @file
* Install, update and uninstall functions for the varbase blog module.
*/
use Drupal\Core\Config\InstallStorage;
use Vardot\Entity\EntityDefinitionUpdateManager;
use Vardot\Installer\ModuleInstallerFactory;
// Include all helpers and updates.
include_once __DIR__ . '/includes/helpers.inc';
include_once __DIR__ . '/includes/updates.inc';
/**
* Implements hook_install().
*/
function varbase_blog_install() {
// Processor for install: in varbase_blog.info.yml file.
ModuleInstallerFactory::installList('varbase_blog');
// Install optional configs.
ModuleInstallerFactory::importConfigsFromScanedDirectory('varbase_blog', '/^field.storage.*\\.(yml)$/i');
ModuleInstallerFactory::importConfigsFromScanedDirectory('varbase_blog', '/^.*(settings.yml)$/i');
// Entity updates to clear up any mismatched entity and/or field definitions
// And Fix changes were detected in the entity type and field definitions.
\Drupal::classResolver()
->getInstanceFromDefinition(EntityDefinitionUpdateManager::class)
->applyUpdates();
// Forced configs import on install.
$forced_configs = [
'views.view.taxonomy_term',
'taxonomy.vocabulary.tags',
'core.entity_view_display.taxonomy_term.tags.default',
'core.entity_view_display.taxonomy_term.tags.full',
];
ModuleInstallerFactory::importConfigsFromList('varbase_blog', $forced_configs, InstallStorage::CONFIG_OPTIONAL_DIRECTORY);
// Add permissions.
ModuleInstallerFactory::addPermissions('varbase_blog');
}