You are here

class InstallCommand in CKEditor Media Embed Plugin 8

Same name in this branch
  1. 8 src/Command/InstallCommand.php \Drupal\ckeditor_media_embed\Command\InstallCommand
  2. 8 src/Command/Drush/InstallCommand.php \Drupal\ckeditor_media_embed\Command\Drush\InstallCommand

Class InstallCommand.

@package Drupal\ckeditor_media_embed

@DrupalCommand ( extension="ckeditor_media_embed", extensionType="module" )

Hierarchy

  • class \Drupal\ckeditor_media_embed\Command\InstallCommand extends \Drupal\Console\Core\Command\Command implements CKEditorCliCommandInterface uses \Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait

Expanded class hierarchy of InstallCommand

1 string reference to 'InstallCommand'
console.services.yml in ./console.services.yml
console.services.yml
1 service uses InstallCommand
ckeditor_media_embed_install in ./console.services.yml
Drupal\ckeditor_media_embed\Command\InstallCommand

File

src/Command/InstallCommand.php, line 24

Namespace

Drupal\ckeditor_media_embed\Command
View source
class InstallCommand extends Command implements CKEditorCliCommandInterface {
  use ContainerAwareCommandTrait;

  /**
   * The CKEditor Media Embed CLI Commands service.
   *
   * @var \Drupal\ckeditor_media_embed\CLICommands
   */
  protected $cliCommands;

  /**
   * {@inheritdoc}
   */
  public function __construct(CliCommandWrapper $cliCommands) {
    parent::__construct();
    $this->cliCommands = $cliCommands;
  }

  /**
   * {@inheritdoc}
   */
  protected function configure() {
    $this
      ->setName('ckeditor_media_embed:install')
      ->setDescription($this
      ->trans('commands.ckeditor_media_embed.install.description'));
  }

  /**
   * {@inheritdoc}
   */
  protected function execute(InputInterface $input, OutputInterface $output) {
    $this->input = $input;
    $this->output = $output;
    $this->io = new DrupalStyle($input, $output);
    $overwrite = $this->cliCommands
      ->askToOverwritePluginFiles($this);
    if ($overwrite) {
      $this->cliCommands
        ->overwritePluginFiles($this, $overwrite);
    }
  }

  /**
   * {@inheritdoc}
   */
  public function getInput() {
    return $this->input;
  }

  /**
   * {@inheritdoc}
   */
  public function getIo() {
    return $this->io;
  }

  /**
   * {@inheritdoc}
   */
  public function getMessage($message_key) {
    return $this
      ->trans("commands.ckeditor_media_embed.install.messages.{$message_key}");
  }

  /**
   * {@inheritdoc}
   */
  public function confirmation($question, $default = FALSE) {
    $helper = $this
      ->getHelper('question');
    $confirmation_question = new ConfirmationQuestion($question, $default);
    return $helper
      ->ask($this->input, $this->output, $confirmation_question);
  }

  /**
   * {@inheritdoc}
   */
  public function comment($text) {
    $this->io
      ->comment($text);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
InstallCommand::$cliCommands protected property The CKEditor Media Embed CLI Commands service.
InstallCommand::comment public function Output message in comment style. Overrides CKEditorCliCommandInterface::comment
InstallCommand::configure protected function 1
InstallCommand::confirmation public function Present confirmation question to user. Overrides CKEditorCliCommandInterface::confirmation
InstallCommand::execute protected function
InstallCommand::getInput public function Retrieve the command input service. Overrides CKEditorCliCommandInterface::getInput
InstallCommand::getIo public function Retrieve the i/o style. Overrides CKEditorCliCommandInterface::getIo
InstallCommand::getMessage public function Retrieve message text. Overrides CKEditorCliCommandInterface::getMessage
InstallCommand::__construct public function