You are here

static function RealisticDummyContent::improve_dummy_content in Realistic Dummy Content 8

Insert or improve dummy data in an entity of a given type.

Parameters

$entity: The object for a given type, for example this can be a user object or a node object.

$type: The type of the information to change, for example 'user' or 'node'.

Throws

\Exception

2 calls to RealisticDummyContent::improve_dummy_content()
RealisticDummyContent::entity_presave in api/src/facade/RealisticDummyContent.php
Implements hook_entity_insert().
realistic_dummy_content_api_improve_dummy_content in api/realistic_dummy_content_api.module
Insert or improve dummy data in an entity of a given type.

File

api/src/facade/RealisticDummyContent.php, line 106
Define autoload class.

Class

RealisticDummyContent

Namespace

Drupal\realistic_dummy_content_api\facade

Code

static function improve_dummy_content(&$entity, $type) {
  $modifiers = \Drupal::moduleHandler()
    ->invokeAll('realistic_dummy_content_api_class', array(
    $entity,
    $type,
  ));
  foreach ($modifiers as $modifier_class) {
    RealisticDummyContent::validate_class($modifier_class);
    $modifier = new $modifier_class($entity, $type);
    $modifier
      ->Modify();
    $entity = $modifier
      ->GetEntity();
  }
}