You are here

public function CliCommandWrapper::askToOverwritePluginFiles in CKEditor Media Embed Plugin 8

Present question to user about overwriting the plugin files.

Parameters

$command: A command object (e.g., a Drush or Drupal Console command).

Return value

bool TRUE if given affirmative response to overwrite plugin files, FALSE otherwise.

File

src/Command/CliCommandWrapper.php, line 103

Class

CliCommandWrapper
Class CLICommands.

Namespace

Drupal\ckeditor_media_embed\Command

Code

public function askToOverwritePluginFiles(CKEditorCliCommandInterface $command) {
  $yes = $command
    ->getInput()
    ->hasOption('yes') ? $command
    ->getInput()
    ->getOption('yes') : FALSE;
  if (!$yes) {
    $libraries_path = AssetManager::getCKEditorLibraryPluginDirectory();
    if (file_exists($libraries_path)) {
      $question = sprintf($command
        ->getMessage('question-overwrite-files'), $libraries_path);
      return $command
        ->confirmation($question);
    }
  }
  return TRUE;
}