You are here

public function RealisticDummyContentDevelGenerateGenerator::implementGenerate in Realistic Dummy Content 7.2

Same name and namespace in other branches
  1. 8.2 api/src/includes/RealisticDummyContentDevelGenerateGenerator.php \Drupal\realistic_dummy_content_api\includes\RealisticDummyContentDevelGenerateGenerator::implementGenerate()
  2. 3.x api/src/includes/RealisticDummyContentDevelGenerateGenerator.php \Drupal\realistic_dummy_content_api\includes\RealisticDummyContentDevelGenerateGenerator::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, array(
      'node_types' => array(
        $this
          ->getBundle() => $this
          ->getBundle(),
      ),
      'users' => array(
        1,
      ),
      'title_length' => 3,
    ));
  }
  Framework::instance()
    ->develGenerate($info);
}