class GenerateTermsCommand
Attributes
#[AsCommand(name: 'devel-generate:terms', description: 'Create terms in specified vocabulary.', aliases: [
'gent',
'devel-generate-terms',
])]
Hierarchy
- class \Drupal\devel_generate\Drush\Commands\GenerateTermsCommand uses \Drush\Commands\AutowireTrait extends \Symfony\Component\Console\Command\Command
Expanded class hierarchy of GenerateTermsCommand
File
-
devel_generate/
src/ Drush/ Commands/ GenerateTermsCommand.php, line 16
Namespace
Drupal\devel_generate\Drush\CommandsView source
final class GenerateTermsCommand extends Command {
use AutowireTrait;
const PLUGIN_ID = 'term';
public function __construct(protected DevelGeneratePluginManager $manager) {
parent::__construct();
}
protected function configure() : void {
$this->addArgument('num', InputArgument::OPTIONAL, 'Number of terms to generate.', '50')
->addOption('kill', NULL, InputOption::VALUE_NONE, 'Delete all terms in these vocabularies before generating new ones.')
->addOption('bundles', NULL, InputOption::VALUE_REQUIRED, 'A comma-delimited list of machine names for the vocabularies where terms will be created.')
->addOption('feedback', NULL, InputOption::VALUE_REQUIRED, 'An integer representing interval for insertion rate logging.', '1000')
->addOption('languages', NULL, InputOption::VALUE_REQUIRED, 'A comma-separated list of language codes')
->addOption('translations', NULL, InputOption::VALUE_REQUIRED, 'A comma-separated list of language codes for translations.')
->addOption('min-depth', NULL, InputOption::VALUE_REQUIRED, 'The minimum depth of hierarchy for the new terms.', '1')
->addOption('max-depth', NULL, InputOption::VALUE_REQUIRED, 'The maximum depth of hierarchy for the new terms.', '4');
}
public function execute(InputInterface $input, OutputInterface $output) : int {
/** @var \Drupal\devel_generate\DevelGenerateBaseInterface $instance */
$instance = $this->manager
->createInstance(self::PLUGIN_ID, []);
$parameters = $instance->validateDrushParams($input->getArguments(), $input->getOptions());
$instance->generate($parameters);
return Command::SUCCESS;
}
}
Members
| Title Sort descending | Modifiers | Object type | Summary |
|---|---|---|---|
| GenerateTermsCommand::configure | protected | function | |
| GenerateTermsCommand::execute | public | function | |
| GenerateTermsCommand::PLUGIN_ID | constant | ||
| GenerateTermsCommand::__construct | public | function |