You are here

public function ConfigSplitManager::commitAll in Configuration Split 2.0.x

Make the split permanent by copying the preview to the split storage.

File

src/ConfigSplitManager.php, line 214

Class

ConfigSplitManager
The manager to split and merge.

Namespace

Drupal\config_split

Code

public function commitAll() : void {
  $splits = $this->factory
    ->loadMultiple($this->factory
    ->listAll('config_split'));
  $splits = array_filter($splits, function (ImmutableConfig $config) {
    return $config
      ->get('status');
  });

  // Copy the preview to the permanent place.
  foreach ($splits as $split) {
    $preview = $this
      ->getPreviewStorage($split);
    $permanent = $this
      ->getSplitStorage($split);
    if ($preview !== NULL && $permanent !== NULL) {
      self::replaceStorageContents($preview, $permanent);
    }
  }
}