You are here

public function ConfigSplitCliService::ioImport in Configuration Split 2.0.x

Same name and namespace in other branches
  1. 8 src/ConfigSplitCliService.php \Drupal\config_split\ConfigSplitCliService::ioImport()

Handle the import interaction.

Parameters

string $split: The split name to import.

\Symfony\Component\Console\Style\StyleInterface|object $io: The $io interface of the cli tool calling.

callable $t: The translation function akin to t().

bool $confirmed: Whether the import is already confirmed by the console input.

File

src/ConfigSplitCliService.php, line 136

Class

ConfigSplitCliService
The CLI service class for interoperability.

Namespace

Drupal\config_split

Code

public function ioImport(string $split, $io, callable $t, $confirmed = FALSE) : bool {
  $config = $this
    ->getSplitFromArgument($split, $io, $t);
  if ($config === NULL) {
    return FALSE;
  }
  $message = $t('Import the split config configuration?');
  $storage = $this->manager
    ->singleImport($config, FALSE);
  if ($confirmed || $io
    ->confirm($message)) {
    return $this
      ->tryImport($storage, $io, $t);
  }
  return TRUE;
}