class GenerateMediaCommand
Same name in this branch
- 5.x devel_generate/src/Drush/Commands/GenerateMediaCommand.php \Drupal\devel_generate\Drush\Commands\GenerateMediaCommand
Create media items.
Attributes
#[AsCommand(name: self::NAME, description: 'Create media items.', aliases: [
'genmd',
'devel-generate-media',
], usages: [
'devel-generate:media 20 --media-types=image --kill',
])]
Hierarchy
- class \Drupal\devel_generate\Command\GenerateMediaCommand uses \Drupal\devel_generate\Command\GenerateCommandTrait
Expanded class hierarchy of GenerateMediaCommand
2 files declare their use of GenerateMediaCommand
- GenerateCommandsKernelTest.php in devel_generate/
tests/ src/ Kernel/ GenerateCommandsKernelTest.php - GenerateMediaCommand.php in devel_generate/
src/ Drush/ Commands/ GenerateMediaCommand.php
File
-
devel_generate/
src/ Command/ GenerateMediaCommand.php, line 16
Namespace
Drupal\devel_generate\CommandView source
class GenerateMediaCommand {
use GenerateCommandTrait;
public const NAME = 'devel-generate:media';
public const PLUGIN_ID = 'media';
/**
* Create media items.
*
* The arguments and options are read from the input by the plugin.
*/
public function __invoke(InputInterface $input, OutputInterface $output, #[Argument('Number of media to generate.')] string $num = '50', #[Option('Delete all media items before generating new.')] bool $kill = FALSE, #[Option('A comma-delimited list of media types to create.')] ?string $mediaTypes = 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) : int {
return $this->generate(self::PLUGIN_ID, $input, $output, [
'media',
]);
}
}
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 | |
| GenerateMediaCommand::NAME | public | constant | |
| GenerateMediaCommand::PLUGIN_ID | public | constant | |
| GenerateMediaCommand::__invoke | public | function | Create media items. |