You are here

public function RealisticDummyContentDevelGenerateGenerator::implementGenerate in Realistic Dummy Content 3.x

Same name and namespace in other branches
  1. 8.2 api/src/includes/RealisticDummyContentDevelGenerateGenerator.php \Drupal\realistic_dummy_content_api\includes\RealisticDummyContentDevelGenerateGenerator::implementGenerate()
  2. 7.2 api/src/includes/RealisticDummyContentDevelGenerateGenerator.php \Drupal\realistic_dummy_content_api\includes\RealisticDummyContentDevelGenerateGenerator::implementGenerate()

Generate content. Used internally in the class.

Overrides RealisticDummyContentGenerator::implementGenerate

File

api/src/includes/RealisticDummyContentDevelGenerateGenerator.php, line 15

Class

RealisticDummyContentDevelGenerateGenerator
The "devel generate" dummy content generator.

Namespace

Drupal\realistic_dummy_content_api\includes

Code

public function implementGenerate() {
  $info['entity_type'] = $this
    ->getType();
  $info['kill'] = $this
    ->getKill();
  $info['num'] = $this
    ->getNum();
  if (Framework::instance()
    ->moduleExists('comment')) {
    $info['max_comments'] = 5;
  }
  if ($this
    ->getType() == 'node') {

    // See https://www.drupal.org/node/2324027
    $info = array_merge($info, [
      'node_types' => [
        $this
          ->getBundle() => $this
          ->getBundle(),
      ],
      'users' => [
        1,
      ],
      'title_length' => 3,
    ]);
  }
  Framework::instance()
    ->develGenerate($info);
}