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); } // --class option $class_name = $input->getOption('class'); if (!$class_name) { $class_name = $io->ask($this->trans('commands.generate.plugin.ckeditorbutton.questions.class'), 'DefaultCKEditorButton'); $input->setOption('class', $class_name); } // --label option $label = $input->getOption('label'); if (!$label) { $label = $io->ask($this->trans('commands.generate.plugin.ckeditorbutton.questions.label'), $this->stringConverter->camelCaseToHuman($class_name)); $input->setOption('label', $label); } // --plugin-id option $plugin_id = $input->getOption('plugin-id'); if (!$plugin_id) { $plugin_id = $io->ask($this->trans('commands.generate.plugin.ckeditorbutton.questions.plugin-id'), $this->stringConverter->camelCaseToLowerCase($label)); $input->setOption('plugin-id', $plugin_id); } // --button-name option $button_name = $input->getOption('button-name'); if (!$button_name) { $button_name = $io->ask($this->trans('commands.generate.plugin.ckeditorbutton.questions.button-name'), $this->stringConverter->anyCaseToUcFirst($plugin_id)); $input->setOption('button-name', $button_name); } // --button-icon-path option $button_icon_path = $input->getOption('button-icon-path'); if (!$button_icon_path) { $button_icon_path = $io->ask($this->trans('commands.generate.plugin.ckeditorbutton.questions.button-icon-path'), drupal_get_path('module', $module) . '/js/plugins/' . $plugin_id . '/images/icon.png'); $input->setOption('button-icon-path', $button_icon_path); } }