function config_import_invoke_owner

Invokes MODULE_config_import() callbacks for configuration changes.

@todo Add support for other extension types; e.g., themes etc.

Parameters

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.

3 calls to config_import_invoke_owner()
config_import in drupal/core/includes/config.inc
Imports configuration into the active configuration.
config_install_default_config in drupal/core/includes/config.inc
Installs the default configuration of a given extension.
ViewTestData::importTestViews in drupal/core/modules/views/lib/Drupal/views/Tests/ViewTestData.php
Imports test views from config.

File

drupal/core/includes/config.inc, line 247
This is the API for configuration storage.

Code

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;
}