You are here

public static function RealisticDummyContentRecipe::getGenerator in Realistic Dummy Content 7.2

Same name and namespace in other branches
  1. 8.2 api/src/includes/RealisticDummyContentRecipe.php \Drupal\realistic_dummy_content_api\includes\RealisticDummyContentRecipe::getGenerator()
  2. 3.x api/src/includes/RealisticDummyContentRecipe.php \Drupal\realistic_dummy_content_api\includes\RealisticDummyContentRecipe::getGenerator()

Return a concrete generator class to generate content.

Parameters

array $more: Can contain: kill => TRUE|FALSE.

1 call to RealisticDummyContentRecipe::getGenerator()
RealisticDummyContentRecipe::newEntities in api/src/includes/RealisticDummyContentRecipe.php
Create new entities.

File

api/src/includes/RealisticDummyContentRecipe.php, line 93

Class

RealisticDummyContentRecipe
Abstract base "recipe" class.

Namespace

Drupal\realistic_dummy_content_api\includes

Code

public static function getGenerator($type, $bundle, $count, $more) {
  if (in_array($type, array(
    'user',
    'node',
  ))) {
    if (Framework::instance()
      ->moduleExists('devel_generate')) {
      return new RealisticDummyContentDevelGenerateGenerator($type, $bundle, $count, $more);
    }
    else {
      self::$log
        ->error(t("Please enable devel's devel_generate module to generate users or nodes."));
    }
  }
  else {
    self::$log
      ->error(t('Entity types other than user and node are not supported for realistic dummy content recipe.'));
  }
}