class GenerateBlockCommand

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

Create Block content blocks.

Attributes

#[AsCommand(name: self::NAME, description: 'Create Block content blocks.', aliases: [ 'genbc', 'devel-generate-block-content', ], usages: [ 'devel-generate:block-content 20 --block_types=basic --kill', ])]

Hierarchy

Expanded class hierarchy of GenerateBlockCommand

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

File

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

Namespace

Drupal\devel_generate\Command
View source
class GenerateBlockCommand {
  use GenerateCommandTrait;
  public const NAME = 'devel-generate:block-content';
  public const PLUGIN_ID = 'block_content';
  
  /**
   * Create Block content blocks.
   *
   * The arguments and options are read from the input by the plugin.
   */
  public function __invoke(InputInterface $input, OutputInterface $output, #[Argument('Number of blocks to generate.')] string $num = '50', #[Option('Delete all block content before generating new.')] bool $kill = FALSE, #[Option('A comma-delimited list of block content types to create.', name: 'block_types')] string $blockTypes = 'basic', #[Option('A comma delimited list of authors ids. Defaults to all users.')] ?string $authors = 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 block type label to the front of the node title')] bool $addTypeLabel = FALSE, #[Option('Create re-usable blocks. Disable for inline Layout Builder blocks, for example.')] bool $reusable = FALSE) : int {
    return $this->generate(self::PLUGIN_ID, $input, $output, [
      'block_content',
    ]);
  }

}

Members

Title Sort descending Modifiers Object type Summary
GenerateBlockCommand::NAME public constant
GenerateBlockCommand::PLUGIN_ID public constant
GenerateBlockCommand::__invoke public function Create Block content blocks.
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