static function RealisticDummyContent::entity_presave in Realistic Dummy Content 8
Implements hook_entity_insert().
1 call to RealisticDummyContent::entity_presave()
File
- api/
src/ facade/ RealisticDummyContent.php, line 32 - Define autoload class.
Class
Namespace
Drupal\realistic_dummy_content_api\facadeCode
static function entity_presave(\Drupal\Core\Entity\EntityInterface $entity) {
try {
$type = $entity
->getEntityType();
if (RealisticDummyContent::is_dummy($entity, $type)) {
$candidate = $entity;
RealisticDummyContent::improve_dummy_content($candidate, $type);
RealisticDummyContent::validate($candidate, $type);
$entity = $candidate;
}
} catch (\Exception $e) {
drupal_set_message(t('realistic_dummy_content_api failed to modify dummy objects: message: @m', array(
'@m' => $e
->getMessage(),
)), 'error', FALSE);
}
}