protected function ConfigImporter::importInvokeOwner

Invokes import* methods on configuration entity storage controllers.

Allow modules to take over configuration change operations for higher-level configuration data.

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

1 call to ConfigImporter::importInvokeOwner()
ConfigImporter::import in drupal/core/lib/Drupal/Core/Config/ConfigImporter.php
Imports the changelist to the target storage.

File

drupal/core/lib/Drupal/Core/Config/ConfigImporter.php, line 278
Contains \Drupal\Core\Config\ConfigImporter.

Class

ConfigImporter
Defines a configuration importer.

Namespace

Drupal\Core\Config

Code

protected function importInvokeOwner() {

  // First pass deleted, then new, and lastly changed configuration, in order
  // to handle dependencies correctly.
  foreach (array(
    'delete',
    'create',
    'update',
  ) as $op) {
    foreach ($this
      ->getUnprocessed($op) as $name) {

      // Call to the configuration entity's storage controller to handle the
      // configuration change.
      $handled_by_module = FALSE;

      // Validate the configuration object name before importing it.
      // Config::validateName($name);
      if ($entity_type = config_get_entity_type_by_name($name)) {
        $old_config = new Config($name, $this->storageComparer
          ->getTargetStorage(), $this->context);
        $old_config
          ->load();
        $data = $this->storageComparer
          ->getSourceStorage()
          ->read($name);
        $new_config = new Config($name, $this->storageComparer
          ->getTargetStorage(), $this->context);
        if ($data !== FALSE) {
          $new_config
            ->setData($data);
        }
        $method = 'import' . ucfirst($op);
        $handled_by_module = $this->entityManager
          ->getStorageController($entity_type)
          ->{$method}($name, $new_config, $old_config);
      }
      if (!empty($handled_by_module)) {
        $this
          ->setProcessed($op, $name);
      }
    }
  }
}