-
Notifications
You must be signed in to change notification settings - Fork 1
/
varbase_seo.install
58 lines (46 loc) · 2.08 KB
/
varbase_seo.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
<?php
/**
* @file
* Install, update and uninstall functions for the Varbase SEO module.
*/
use Vardot\Entity\EntityDefinitionUpdateManager;
use Vardot\Installer\ModuleInstallerFactory;
use Drupal\Core\Recipe\Recipe;
use Drupal\Core\Recipe\RecipeRunner;
// Include all helpers and updates.
include_once __DIR__ . '/includes/helpers.inc';
include_once __DIR__ . '/includes/updates.inc';
/**
* Implements hook_install().
*/
function varbase_seo_install() {
$default_recipe = Recipe::createFromDirectory(__DIR__ . '/recipes/default');
RecipeRunner::processRecipe($default_recipe);
// Set the weight of the module after installation of list of modules.
// To make sure that any hook or event subscriber worker
// after all used modules.
ModuleInstallerFactory::setModuleWeightAfterInstallation('varbase_seo', 'set_weight_after');
// If the google analytics module were enabled we load the custom GA settings.
if (\Drupal::moduleHandler()->moduleExists('google_analytics')) {
// Varbase SEO custom google analytics config settings.
$google_analytics_managed_optional_configs = [
'google_analytics.settings',
];
ModuleInstallerFactory::importConfigsFromList('varbase_seo', $google_analytics_managed_optional_configs, 'config/managed/google_analytics');
}
// 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();
// Have forced configs import after the entity and definitions updates.
$forced_configs_import_after_entity_updates = [
'views.view.redirect_404',
];
ModuleInstallerFactory::importConfigsFromList('varbase_seo', $forced_configs_import_after_entity_updates);
// 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();
}