class GenerateContentCommand
Same name in this branch
- 5.x devel_generate/src/Drush/Commands/GenerateContentCommand.php \Drupal\devel_generate\Drush\Commands\GenerateContentCommand
Create content.
Attributes
#[AsCommand(name: self::NAME, description: 'Create content.', aliases: [
'genc',
'devel-generate-content',
], usages: [
'devel-generate:content 20 5 --bundles=article --kill',
])]
Hierarchy
- class \Drupal\devel_generate\Command\GenerateContentCommand uses \Drupal\devel_generate\Command\GenerateCommandTrait
Expanded class hierarchy of GenerateContentCommand
2 files declare their use of GenerateContentCommand
- GenerateCommandsKernelTest.php in devel_generate/
tests/ src/ Kernel/ GenerateCommandsKernelTest.php - GenerateContentCommand.php in devel_generate/
src/ Drush/ Commands/ GenerateContentCommand.php
File
-
devel_generate/
src/ Command/ GenerateContentCommand.php, line 16
Namespace
Drupal\devel_generate\CommandView source
class GenerateContentCommand {
use GenerateCommandTrait;
public const NAME = 'devel-generate:content';
public const PLUGIN_ID = 'content';
/**
* Create content.
*
* The arguments and options are read from the input by the plugin.
*/
public function __invoke(InputInterface $input, OutputInterface $output, #[Argument('Number of nodes to generate.')] string $num = '50', #[Argument('Maximum number of comments to generate.', name: 'max_comments')] string $maxComments = '0', #[Option('Delete all content before generating new content.')] bool $kill = FALSE, #[Option('A comma-delimited list of content types to create.')] string $bundles = 'page,article', #[Option('A comma delimited list of authors ids. Defaults to all users.')] ?string $authors = NULL, #[Option('A comma delimited list of role machine names to filter the random selection of users. Defaults to all roles.')] ?string $roles = NULL, #[Option('An integer representing interval for insertion rate logging.')] string $feedback = '1000', #[Option('A comma delimited list of fields to omit when generating random values')] ?string $skipFields = NULL, #[Option('A comma delimited list of base field names to populate')] ?string $baseFields = NULL, #[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('Add the content type label to the front of the node title')] bool $addTypeLabel = FALSE) : int {
return $this->generate(self::PLUGIN_ID, $input, $output, [
'node',
]);
}
}
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 | |
| GenerateContentCommand::NAME | public | constant | |
| GenerateContentCommand::PLUGIN_ID | public | constant | |
| GenerateContentCommand::__invoke | public | function | Create content. |