You are here

protected function ConfigSyncSnapshotter::createItemSnapshot in Configuration Synchronizer 8

Creates a snapshot of a given configuration item as provided by an extension.

Parameters

InMemoryStorage $config_storage: An extension's configuration file storage.

string $item_name: The name of the configuration item.

1 call to ConfigSyncSnapshotter::createItemSnapshot()
ConfigSyncSnapshotter::refreshSnapshot in src/ConfigSyncSnapshotter.php
Takes a snapshot of configuration from modules and themes.

File

src/ConfigSyncSnapshotter.php, line 112

Class

ConfigSyncSnapshotter
The ConfigSyncSnapshotter provides helper functions for taking snapshots of extension-provided configuration.

Namespace

Drupal\config_sync

Code

protected function createItemSnapshot(InMemoryStorage $config_storage, $item_name) {

  // Snapshot the configuration item as provided by the extension.
  if ($provided_data = $config_storage
    ->read($item_name)) {
    $this->snapshotExtensionStorage
      ->write($item_name, $provided_data);
  }

  // Snapshot the configuration item as installed in the active storage if
  // a snapshot doesn't already exist. The snapshot represents the original
  // installed state.
  if (($active_data = $this->activeStorage
    ->read($item_name)) && !$this->snapshotActiveStorage
    ->read($item_name)) {
    $this->snapshotActiveStorage
      ->write($item_name, $active_data);
  }
}