You are here

public function ConfigDistroFilterEventSubscriber::onDistroTransform in Config Distro 8

The storage is transformed for importing.

Parameters

\Drupal\config_distro\Event\DistroStorageTransformEvent $event:

File

modules/config_distro_filter/src/ConfigDistroFilterEventSubscriber.php, line 41

Class

ConfigDistroFilterEventSubscriber
Class ConfigDistroFilterEventSubscriber.

Namespace

Drupal\config_distro_filter

Code

public function onDistroTransform(DistroStorageTransformEvent $event) {
  $storage = $event
    ->getStorage();

  // The temporary storage representing the active storage.
  $temp = new MemoryStorage();

  // Get the filtered storage based on the event storage.
  $filtered = $this->filterStorageFactory
    ->getFilteredStorage($storage, [
    'config_distro.storage.distro',
  ]);

  // Simulate the importing of configuration.
  self::replaceStorageContents($filtered, $temp);

  // Set the event storage to the one of the simulated import.
  self::replaceStorageContents($temp, $storage);
}