->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')
);
// @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration
if (!$this->confirmGeneration($io)) {
- return;
+ return 1;
}
$theme = $this->validator->validateModuleName($input->getOption('theme'));
$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');
$package,
$base_theme,
$global_library,
+ $libraries,
$regions,
$breakpoints
);
+
+ return 0;
}
/**
} catch (\Exception $error) {
$io->error($error->getMessage());
- return;
+ return 1;
}
if (!$theme) {
} catch (\Exception $error) {
$io->error($error->getMessage());
- return;
+ return 1;
}
if (!$machine_name) {
$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) {