From e95210756fe9dc22f6b8240fedc58c8cd1accf98 Mon Sep 17 00:00:00 2001 From: Nikolay Lobachev Date: Sun, 7 Apr 2019 00:11:13 +0200 Subject: [PATCH] 3860 region options (#3959) * Add new arguments key and target. Make it possible use not only default target for db connections * Fix region options --- src/Command/Generate/PluginBlockCommand.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Command/Generate/PluginBlockCommand.php b/src/Command/Generate/PluginBlockCommand.php index f525e007a..ee10ea896 100644 --- a/src/Command/Generate/PluginBlockCommand.php +++ b/src/Command/Generate/PluginBlockCommand.php @@ -224,9 +224,6 @@ protected function execute(InputInterface $input, OutputInterface $output) protected function interact(InputInterface $input, OutputInterface $output) { - $theme = $this->configFactory->get('system.theme')->get('default'); - $themeRegions = \system_region_list($theme, REGIONS_VISIBLE); - // --module option $this->getModuleOption(); @@ -265,10 +262,17 @@ function ($class) { // --theme-region option $themeRegion = $input->getOption('theme-region'); + if (!$themeRegion) { + $theme = $this->configFactory->get('system.theme')->get('default'); + $themeRegions = \system_region_list($theme, REGIONS_VISIBLE); + $themeRegionOptions = []; + foreach ($themeRegions as $key => $region) { + $themeRegionOptions[$key] = $region->render(); + } $themeRegion = $this->getIo()->choiceNoList( $this->trans('commands.generate.plugin.block.questions.theme-region'), - array_values($themeRegions), + $themeRegionOptions, '', true );