public function ConfigStorageController::importUpdate

Updates configuration upon synchronizing configuration changes.

This callback is invoked when configuration is synchronized between storages and allows a module to take over the synchronization of configuration data.

Parameters

string $name: The name of the configuration object.

\Drupal\Core\Config\Config $new_config: A configuration object containing the new configuration data.

\Drupal\Core\Config\Config $old_config: A configuration object containing the old configuration data.

1 call to ConfigStorageController::importUpdate()
1 method overrides ConfigStorageController::importUpdate()

File

drupal/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php, line 500
Definition of Drupal\Core\Config\Entity\ConfigStorageController.

Class

ConfigStorageController
Defines the storage controller class for configuration entities.

Namespace

Drupal\Core\Config\Entity

Code

public function importUpdate($name, Config $new_config, Config $old_config) {
  $id = static::getIDFromConfigName($name, $this->entityInfo['config_prefix']);
  $entities = $this
    ->load(array(
    $id,
  ));
  $entity = $entities[$id];
  $entity->original = clone $entity;
  foreach ($old_config
    ->get() as $property => $value) {
    $entity->original
      ->set($property, $value);
  }
  foreach ($new_config
    ->get() as $property => $value) {
    $entity
      ->set($property, $value);
  }
  $entity
    ->save();
  return TRUE;
}