function dxpr_theme_helper_update_8001 in DXPR Theme Helper 1.0.x
Adds enforced config dependencies.
1 call to dxpr_theme_helper_update_8001()
- dxpr_theme_helper_install in ./
dxpr_theme_helper.install - Implements hook_install.
File
- ./
dxpr_theme_helper.install, line 20 - Install, update, uninstall and schema functions for the module.
Code
function dxpr_theme_helper_update_8001() {
$config_list = [
"field.storage.node.field_dth_body_background",
"field.storage.node.field_dth_hide_regions",
"field.storage.node.field_dth_main_content_width",
"field.storage.node.field_dth_page_layout",
"field.storage.node.field_dth_page_title_backgrou",
];
$config_factory = Drupal::configFactory();
$list_all = $config_factory
->listAll();
$module_name = 'dxpr_theme_helper';
foreach ($config_list as $config_name) {
if (!in_array($config_name, $list_all)) {
continue;
}
$config = $config_factory
->getEditable($config_name);
if ($config
->isNew()) {
continue;
}
$dependencies = $config
->get('dependencies');
if (!isset($dependencies['enforced']['module']) || !is_array($dependencies['enforced']['module']) || !in_array($module_name, $dependencies['enforced']['module'])) {
$dependencies['enforced']['module'][] = $module_name;
$config
->set('dependencies', $dependencies)
->save();
}
}
}