You are here

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

Get the preview storage.

Parameters

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

\Drupal\Core\Config\StorageInterface|null $transforming: The transforming storage.

Return value

\Drupal\Core\Config\StorageInterface|null The preview storage.

4 calls to ConfigSplitManager::getPreviewStorage()
ConfigSplitManager::commitAll in src/ConfigSplitManager.php
Make the split permanent by copying the preview to the split storage.
ConfigSplitManager::exportTransform in src/ConfigSplitManager.php
Process the export of a split.
ConfigSplitManager::singleDeactivate in src/ConfigSplitManager.php
Deactivate a split.
ConfigSplitManager::singleExportPreview in src/ConfigSplitManager.php
Get the single export preview.

File

src/ConfigSplitManager.php, line 519

Class

ConfigSplitManager
The manager to split and merge.

Namespace

Drupal\config_split

Code

public function getPreviewStorage(ImmutableConfig $config, StorageInterface $transforming = NULL) : ?StorageInterface {
  if ('collection' === $config
    ->get('storage')) {
    if ($transforming instanceof StorageInterface) {
      return new SplitCollectionStorage($transforming, $config
        ->get('id'));
    }
    return NULL;
  }
  $name = substr($config
    ->getName(), strlen('config_split.config_split.'));
  $name = 'config_split_preview_' . strtr($name, [
    '.' => '_',
  ]);

  // Use the database for everything.
  return new DatabaseStorage($this->connection, $this->connection
    ->escapeTable($name));
}