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 );