X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=vendor%2Fdrupal%2Fconsole%2Fsrc%2FCommand%2FGenerate%2FModuleFileCommand.php;fp=vendor%2Fdrupal%2Fconsole%2Fsrc%2FCommand%2FGenerate%2FModuleFileCommand.php;h=33bdf7e5f8b6d0fa5055bf0d59904520da2fce67;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hp=0000000000000000000000000000000000000000;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad;p=yaffs-website diff --git a/vendor/drupal/console/src/Command/Generate/ModuleFileCommand.php b/vendor/drupal/console/src/Command/Generate/ModuleFileCommand.php new file mode 100644 index 000000000..33bdf7e5f --- /dev/null +++ b/vendor/drupal/console/src/Command/Generate/ModuleFileCommand.php @@ -0,0 +1,110 @@ +extensionManager = $extensionManager; + $this->generator = $generator; + parent::__construct(); + } + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this + ->setName('generate:module:file') + ->setDescription($this->trans('commands.generate.module.file.description')) + ->setHelp($this->trans('commands.generate.module.file.help')) + ->addOption('module', '', InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration + if (!$this->confirmGeneration($io, $yes)) { + return; + } + + $machine_name = $input->getOption('module'); + $file_path = $this->extensionManager->getModule($machine_name)->getPath(); + $generator = $this->generator; + + $generator->generate( + $machine_name, + $file_path + ); + } + + + /** + * {@inheritdoc} + */ + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // --module option + $module = $input->getOption('module'); + + if (!$module) { + // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion + $module = $this->moduleQuestion($io); + } + + $input->setOption('module', $module); + } +}