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