You are here

public function Drupal8::develGenerate in Realistic Dummy Content 3.x

Same name and namespace in other branches
  1. 8.2 api/src/Framework/Drupal8.php \Drupal\realistic_dummy_content_api\Framework\Drupal8::develGenerate()
  2. 7.2 api/src/Framework/Drupal8.php \Drupal\realistic_dummy_content_api\Framework\Drupal8::develGenerate()

Use devel generate to generate dummy content.

Parameters

array $info: Can contain: entity_type: user|node node_types: array users: array of users who can own a node title_legth num: int kill: bool.

Overrides Framework::develGenerate

File

api/src/Framework/Drupal8.php, line 50

Class

Drupal8
Drupal 8-specific code.

Namespace

Drupal\realistic_dummy_content_api\Framework

Code

public function develGenerate(array $info) {
  if ($info['entity_type'] == 'node') {
    $info['entity_type'] = 'content';
  }
  $info = array_merge([
    'pass' => 'some-password',
    'time_range' => 0,
    'roles' => [],
  ], $info);

  // @phpstan-ignore-next-line
  $plugin_manager = \Drupal::service('plugin.manager.develgenerate');
  $instance = $plugin_manager
    ->createInstance($info['entity_type'], []);
  $instance
    ->generate($info);
}