protected function GenerateGroupCommand::interact in Metatag 8
File
- src/
Command/ GenerateGroupCommand.php, line 156
Class
- GenerateGroupCommand
- Class GenerateGroupCommand.
Namespace
Drupal\metatag\CommandCode
protected function interact(InputInterface $input, OutputInterface $output) {
// --base_class option.
// @todo Turn this into a choice() option.
$base_class = $input
->getOption('base_class');
if (empty($base_class)) {
$base_class = $this
->getIo()
->ask($this
->trans('commands.generate.metatag.group.questions.base_class'), 'GroupBase');
}
$input
->setOption('base_class', $base_class);
// --module option
$this
->getModuleOption();
// --label option.
$label = $input
->getOption('label');
if (empty($label)) {
$label = $this
->getIo()
->ask($this
->trans('commands.generate.metatag.group.questions.label'));
}
$input
->setOption('label', $label);
// --description option.
$description = $input
->getOption('description');
if (empty($description)) {
$description = $this
->getIo()
->ask($this
->trans('commands.generate.metatag.group.questions.description'));
}
$input
->setOption('description', $description);
// --plugin-id option.
$plugin_id = $input
->getOption('plugin-id');
if (empty($plugin_id)) {
$plugin_id = $this
->getIo()
->ask($this
->trans('commands.generate.metatag.group.questions.plugin_id'));
}
$input
->setOption('plugin-id', $plugin_id);
// --class-name option.
$class_name = $input
->getOption('class-name');
if (!$class_name) {
$class_name = $this
->getIo()
->ask($this
->trans('commands.generate.metatag.group.questions.class_name'), '', function ($class_name) {
return $this->validator
->validateClassName($class_name);
});
$input
->setOption('class-name', $class_name);
}
// --weight option.
// @todo Automatically get the next int value based upon the current group.
$weight = $input
->getOption('weight');
if (is_null($weight)) {
$weight = $this
->getIo()
->ask($this
->trans('commands.generate.metatag.group.questions.weight'), 0);
}
$input
->setOption('weight', $weight);
}