class GenerateTermsCommand

Same name in this branch
  1. 5.x devel_generate/src/Drush/Commands/GenerateTermsCommand.php \Drupal\devel_generate\Drush\Commands\GenerateTermsCommand

Create terms in specified vocabulary.

Attributes

#[AsCommand(name: self::NAME, description: 'Create terms in specified vocabulary.', aliases: [ 'gent', 'devel-generate-terms', ], usages: [ 'devel-generate:terms 20 --bundles=tags --kill', ])]

Hierarchy

Expanded class hierarchy of GenerateTermsCommand

2 files declare their use of GenerateTermsCommand
GenerateCommandsKernelTest.php in devel_generate/tests/src/Kernel/GenerateCommandsKernelTest.php
GenerateTermsCommand.php in devel_generate/src/Drush/Commands/GenerateTermsCommand.php

File

devel_generate/src/Command/GenerateTermsCommand.php, line 16

Namespace

Drupal\devel_generate\Command
View source
class GenerateTermsCommand {
  use GenerateCommandTrait;
  public const NAME = 'devel-generate:terms';
  public const PLUGIN_ID = 'term';
  
  /**
   * Create terms in specified vocabulary.
   *
   * The arguments and options are read from the input by the plugin.
   */
  public function __invoke(InputInterface $input, OutputInterface $output, #[Argument('Number of terms to generate.')] string $num = '50', #[Option('Delete all terms in these vocabularies before generating new ones.')] bool $kill = FALSE, #[Option('A comma-delimited list of machine names for the vocabularies where terms will be created.')] ?string $bundles = NULL, #[Option('An integer representing interval for insertion rate logging.')] string $feedback = '1000', #[Option('A comma-separated list of language codes')] ?string $languages = NULL, #[Option('A comma-separated list of language codes for translations.')] ?string $translations = NULL, #[Option('The minimum depth of hierarchy for the new terms.')] string $minDepth = '1', #[Option('The maximum depth of hierarchy for the new terms.')] string $maxDepth = '4') : int {
    return $this->generate(self::PLUGIN_ID, $input, $output);
  }

}

Members

Title Sort descending Modifiers Object type Summary
GenerateCommandTrait::generate protected function Generates with the given plugin, from the command's arguments and options.
GenerateCommandTrait::processBatch protected function Runs the batch that a plugin has set, if any, in this process.
GenerateCommandTrait::writeMessages protected function Writes the messages that the plugin has set, and clears them.
GenerateCommandTrait::__construct public function
GenerateTermsCommand::NAME public constant
GenerateTermsCommand::PLUGIN_ID public constant
GenerateTermsCommand::__invoke public function Create terms in specified vocabulary.