Invokes MODULE_config_import() callbacks for configuration changes.
@todo Add support for other extension types; e.g., themes etc.
array $config_changes: An array of changes to be loaded.
Drupal\Core\Config\StorageInterface $source_storage: The storage to synchronize configuration from.
Drupal\Core\Config\StorageInterface $target_storage: The storage to synchronize configuration to.
function config_import_invoke_owner(array $config_changes, StorageInterface $source_storage, StorageInterface $target_storage) {
// Allow modules to take over configuration change operations for
// higher-level configuration data.
// First pass deleted, then new, and lastly changed configuration, in order to
// handle dependencies correctly.
foreach (array(
'delete',
'create',
'change',
) as $op) {
foreach ($config_changes[$op] as $key => $name) {
// Extract owner from configuration object name.
$module = strtok($name, '.');
// Check whether the module implements hook_config_import() and ask it to
// handle the configuration change.
$handled_by_module = FALSE;
if (module_exists($module) && module_hook($module, 'config_import_' . $op)) {
$old_config = new Config($name, $target_storage);
$old_config
->load();
$data = $source_storage
->read($name);
$new_config = new Config($name, $target_storage);
if ($data !== FALSE) {
$new_config
->setData($data);
}
$handled_by_module = module_invoke($module, 'config_import_' . $op, $name, $new_config, $old_config);
}
if (!empty($handled_by_module)) {
unset($config_changes[$op][$key]);
}
}
}
return $config_changes;
}