X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fdrupal%2Fconsole%2Fsrc%2FCommand%2FTheme%2FDownloadCommand.php;fp=vendor%2Fdrupal%2Fconsole%2Fsrc%2FCommand%2FTheme%2FDownloadCommand.php;h=eec5beb374b6e72a3b59d9cdb28189db2f0f0242;hp=0000000000000000000000000000000000000000;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad diff --git a/vendor/drupal/console/src/Command/Theme/DownloadCommand.php b/vendor/drupal/console/src/Command/Theme/DownloadCommand.php new file mode 100644 index 000000000..eec5beb37 --- /dev/null +++ b/vendor/drupal/console/src/Command/Theme/DownloadCommand.php @@ -0,0 +1,125 @@ +drupalApi = $drupalApi; + $this->httpClient = $httpClient; + $this->appRoot = $appRoot; + parent::__construct(); + } + + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this + ->setName('theme:download') + ->setDescription($this->trans('commands.theme.download.description')) + ->addArgument('theme', InputArgument::REQUIRED, $this->trans('commands.theme.download.arguments.theme')) + ->addArgument('version', InputArgument::OPTIONAL, $this->trans('commands.theme.download.arguments.version')) + ->addOption( + 'composer', + '', + InputOption::VALUE_NONE, + $this->trans('commands.theme.download.options.composer') + ); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + $theme = $input->getArgument('theme'); + $version = $input->getArgument('version'); + $composer = $input->getOption('composer'); + + if ($composer) { + if (!is_array($theme)) { + $theme = [$theme]; + } + $this->get('chain_queue')->addCommand( + 'module:download', + [ + 'module' => $theme, + '--composer' => true + ], + true, + true + ); + } else { + $this->downloadProject($io, $theme, $version, 'theme'); + } + } + + /** + * {@inheritdoc} + */ + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + $theme = $input->getArgument('theme'); + $version = $input->getArgument('version'); + $composer = $input->getOption('composer'); + + if (!$version && !$composer) { + $version = $this->releasesQuestion($io, $theme); + $input->setArgument('version', $version); + } + } +}