function varbase_seo_modules_installed in Varbase SEO 9.0.x
Same name and namespace in other branches
- 8.6 varbase_seo.module \varbase_seo_modules_installed()
Implements hook_modules_installed().
File
- ./
varbase_seo.module, line 49 - Contains varbase_seo.module.
Code
function varbase_seo_modules_installed($modules) {
// When we enable the Google Analytics module we load the custom GA settings.
if (in_array('google_analytics', $modules)) {
$google_analytics_managed_optional_path = Drupal::service('module_handler')
->getModule('varbase_seo')
->getPath() . '/config/managed/google_analytics';
// Varbase SEO custom google analytics config settings.
$google_analytics_managed_optional_configs = [
'google_analytics.settings',
];
foreach ($google_analytics_managed_optional_configs as $config_name) {
$config_path = $google_analytics_managed_optional_path . '/' . $config_name . '.yml';
$config_content = file_get_contents($config_path);
$config_data = (array) Yaml::parse($config_content);
$config_factory = \Drupal::configFactory()
->getEditable($config_name);
$config_factory
->setData($config_data)
->save(TRUE);
}
// 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();
}
}