)
->addOption(
'module',
- '',
+ null,
InputOption::VALUE_REQUIRED,
$this->trans('commands.common.options.module')
)
->addOption(
'class',
- '',
+ null,
InputOption::VALUE_OPTIONAL,
$this->trans('commands.generate.form.options.class')
)
->addOption(
'form-id',
- '',
+ null,
InputOption::VALUE_OPTIONAL,
$this->trans('commands.generate.form.options.form-id')
)
->addOption(
'services',
- '',
+ null,
InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY,
$this->trans('commands.common.options.services')
)
+ ->addOption(
+ 'config-file',
+ null,
+ InputOption::VALUE_NONE,
+ $this->trans('commands.generate.form.options.config-file')
+ )
->addOption(
'inputs',
- '',
+ null,
InputOption::VALUE_OPTIONAL,
$this->trans('commands.common.options.inputs')
)
->addOption(
'path',
- '',
+ null,
InputOption::VALUE_OPTIONAL,
$this->trans('commands.generate.form.options.path')
)
->addOption(
'menu_link_gen',
- '',
+ null,
InputOption::VALUE_OPTIONAL,
$this->trans('commands.generate.form.options.menu_link_gen')
)
->addOption(
'menu_link_title',
- '',
+ null,
InputOption::VALUE_OPTIONAL,
$this->trans('commands.generate.form.options.menu_link_title')
)
->addOption(
'menu_parent',
- '',
+ null,
InputOption::VALUE_OPTIONAL,
$this->trans('commands.generate.form.options.menu_parent')
)
->addOption(
'menu_link_desc',
- '',
+ null,
InputOption::VALUE_OPTIONAL,
$this->trans('commands.generate.form.options.menu_link_desc')
);
$module = $input->getOption('module');
$services = $input->getOption('services');
$path = $input->getOption('path');
+ $config_file = $input->getOption('config-file');
$class_name = $input->getOption('class');
$form_id = $input->getOption('form-id');
$form_type = $this->formType;
$this
->generator
- ->generate($module, $class_name, $form_id, $form_type, $build_services, $inputs, $path, $menu_link_gen, $menu_link_title, $menu_parent, $menu_link_desc);
+ ->generate($module, $class_name, $form_id, $form_type, $build_services, $config_file, $inputs, $path, $menu_link_gen, $menu_link_title, $menu_parent, $menu_link_desc);
$this->chainQueue->addCommand('router:rebuild', []);
}
// @see use Drupal\Console\Command\Shared\ServicesTrait::servicesQuestion
$services = $this->servicesQuestion($io);
$input->setOption('services', $services);
+
+ // --config_file option
+ $config_file = $input->getOption('config-file');
+
+ if (!$config_file) {
+ $config_file = $io->confirm(
+ $this->trans('commands.generate.form.questions.config-file'),
+ true
+ );
+ $input->setOption('config-file', $config_file);
+ }
// --inputs option
$inputs = $input->getOption('inputs');