You are here

protected function ConfigSplitManager::singleImportOrActivate in Configuration Split 2.0.x

Importing and activating are almost the same.

Parameters

\Drupal\Core\Config\ImmutableConfig $split: The split.

\Drupal\Core\Config\StorageInterface $storage: The storage.

bool $activate: Whether to activate the split in the transformation.

Return value

\Drupal\Core\Config\StorageInterface The storage to pass to a ConfigImporter to do the config changes.

2 calls to ConfigSplitManager::singleImportOrActivate()
ConfigSplitManager::singleActivate in src/ConfigSplitManager.php
Import the config of a single split.
ConfigSplitManager::singleImport in src/ConfigSplitManager.php
Import the config of a single split.

File

src/ConfigSplitManager.php, line 669

Class

ConfigSplitManager
The manager to split and merge.

Namespace

Drupal\config_split

Code

protected function singleImportOrActivate(ImmutableConfig $split, StorageInterface $storage, bool $activate) : StorageInterface {
  $transformation = new MemoryStorage();
  static::replaceStorageContents($this->active, $transformation);
  $this
    ->mergeSplit($split, $transformation, $storage);

  // Activate the split in the transformation so that the importer does it.
  $config = $transformation
    ->read($split
    ->getName());
  if ($activate && $config !== FALSE) {
    $config['status'] = TRUE;
    $transformation
      ->write($split
      ->getName(), $config);
  }
  return $transformation;
}