You are here

protected function ConfigSplitCliService::getSplitName in Configuration Split 8

Get the configuration name from the short name.

Parameters

string $name: The name to get the config name for.

Return value

string The split configuration name.

2 calls to ConfigSplitCliService::getSplitName()
ConfigSplitCliService::ioExport in src/ConfigSplitCliService.php
Handle the export interaction.
ConfigSplitCliService::ioImport in src/ConfigSplitCliService.php
Handle the import interaction.

File

src/ConfigSplitCliService.php, line 389

Class

ConfigSplitCliService
The CLI service class for interoperability.

Namespace

Drupal\config_split

Code

protected function getSplitName($name) {
  if (strpos($name, 'config_split.config_split.') !== 0) {
    $name = 'config_split.config_split.' . $name;
  }
  if (!in_array($name, $this->activeStorage
    ->listAll('config_split.config_split.'))) {
    $names = [];
    foreach ($this->activeStorage
      ->listAll('config_split.config_split.') as $split_name) {
      $names[] = $split_name;
    }
    $names = implode(', ', $names);
    throw new \InvalidArgumentException('The following split is not available: ' . $name . PHP_EOL . 'Available names: ' . $names);
  }
  return $name;
}