public static function RealisticDummyContentRecipe::getGenerator in Realistic Dummy Content 3.x
Same name and namespace in other branches
- 8.2 api/src/includes/RealisticDummyContentRecipe.php \Drupal\realistic_dummy_content_api\includes\RealisticDummyContentRecipe::getGenerator()
- 7.2 api/src/includes/RealisticDummyContentRecipe.php \Drupal\realistic_dummy_content_api\includes\RealisticDummyContentRecipe::getGenerator()
Return a concrete generator class to generate content.
Parameters
string $type: An entity type such as "user" or "node".
mixed $bundle: An entity bundle.
mixed $count: Number of entities to generate.
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 108
Class
- RealisticDummyContentRecipe
- Abstract base "recipe" class.
Namespace
Drupal\realistic_dummy_content_api\includesCode
public static function getGenerator(string $type, $bundle, $count, array $more) {
if (in_array($type, [
'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.'));
}
}