Yaffs site version 1.1
[yaffs-website] / vendor / drupal / console / src / Command / Generate / ThemeCommand.php
index e701435747a59099fa918d6dbb2240f0b467d1e6..4ec9a75094aef9c0bb47b19228ca44c8babe12c1 100644 (file)
@@ -112,56 +112,62 @@ class ThemeCommand extends Command
             ->setHelp($this->trans('commands.generate.theme.help'))
             ->addOption(
                 'theme',
-                '',
+                null,
                 InputOption::VALUE_REQUIRED,
                 $this->trans('commands.generate.theme.options.module')
             )
             ->addOption(
                 'machine-name',
-                '',
+                null,
                 InputOption::VALUE_REQUIRED,
                 $this->trans('commands.generate.theme.options.machine-name')
             )
             ->addOption(
                 'theme-path',
-                '',
+                null,
                 InputOption::VALUE_REQUIRED,
                 $this->trans('commands.generate.theme.options.module-path')
             )
             ->addOption(
                 'description',
-                '',
+                null,
                 InputOption::VALUE_OPTIONAL,
                 $this->trans('commands.generate.theme.options.description')
             )
-            ->addOption('core', '', InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.theme.options.core'))
+            ->addOption('core', null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.theme.options.core'))
             ->addOption(
                 'package',
-                '',
+                null,
                 InputOption::VALUE_OPTIONAL,
                 $this->trans('commands.generate.theme.options.package')
             )
             ->addOption(
                 'global-library',
-                '',
+                null,
                 InputOption::VALUE_OPTIONAL,
                 $this->trans('commands.generate.theme.options.global-library')
             )
+            ->addOption(
+                'libraries',
+                null,
+                InputOption::VALUE_OPTIONAL,
+                $this->trans('commands.generate.theme.options.libraries')
+            )
             ->addOption(
                 'base-theme',
-                '',
+                null,
                 InputOption::VALUE_OPTIONAL,
                 $this->trans('commands.generate.theme.options.base-theme')
             )
             ->addOption(
                 'regions',
-                '',
+                null,
                 InputOption::VALUE_OPTIONAL,
                 $this->trans('commands.generate.theme.options.regions')
             )
             ->addOption(
                 'breakpoints',
-                '',
+                null,
                 InputOption::VALUE_OPTIONAL,
                 $this->trans('commands.generate.theme.options.breakpoints')
             );
@@ -176,7 +182,7 @@ class ThemeCommand extends Command
 
         // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration
         if (!$this->confirmGeneration($io)) {
-            return;
+            return 1;
         }
 
         $theme = $this->validator->validateModuleName($input->getOption('theme'));
@@ -189,6 +195,7 @@ class ThemeCommand extends Command
         $package = $input->getOption('package');
         $base_theme = $input->getOption('base-theme');
         $global_library = $input->getOption('global-library');
+        $libraries = $input->getOption('libraries');
         $regions = $input->getOption('regions');
         $breakpoints = $input->getOption('breakpoints');
 
@@ -201,9 +208,12 @@ class ThemeCommand extends Command
             $package,
             $base_theme,
             $global_library,
+            $libraries,
             $regions,
             $breakpoints
         );
+
+        return 0;
     }
 
     /**
@@ -218,7 +228,7 @@ class ThemeCommand extends Command
         } catch (\Exception $error) {
             $io->error($error->getMessage());
 
-            return;
+            return 1;
         }
 
         if (!$theme) {
@@ -238,7 +248,7 @@ class ThemeCommand extends Command
         } catch (\Exception $error) {
             $io->error($error->getMessage());
 
-            return;
+            return 1;
         }
 
         if (!$machine_name) {
@@ -326,6 +336,21 @@ class ThemeCommand extends Command
             $input->setOption('global-library', $global_library);
         }
 
+
+        // --libraries option.
+        $libraries = $input->getOption('libraries');
+        if (!$libraries) {
+            if ($io->confirm(
+                $this->trans('commands.generate.theme.questions.library-add'),
+                true
+            )
+            ) {
+                // @see \Drupal\Console\Command\Shared\ThemeRegionTrait::libraryQuestion
+                $libraries = $this->libraryQuestion($io);
+                $input->setOption('libraries', $libraries);
+            }
+        }
+
         // --regions option.
         $regions = $input->getOption('regions');
         if (!$regions) {