Yaffs site version 1.1
[yaffs-website] / vendor / drupal / console / src / Command / Generate / FormCommand.php
index 8014462eb3bc164eb47f4994cd32cf212503445a..58a2582a18aed66bbd81e43bd47a2f436ea96f70 100644 (file)
@@ -122,61 +122,67 @@ abstract class FormCommand extends Command
             )
             ->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')
             );
@@ -190,6 +196,7 @@ abstract class FormCommand extends Command
         $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;
@@ -204,7 +211,7 @@ abstract class FormCommand extends Command
 
         $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', []);
     }
@@ -248,6 +255,17 @@ abstract class FormCommand extends Command
         // @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');