public function Drupal8::hookEntityPresave in Realistic Dummy Content 7.2
Same name and namespace in other branches
- 8.2 api/src/Framework/Drupal8.php \Drupal\realistic_dummy_content_api\Framework\Drupal8::hookEntityPresave()
- 3.x api/src/Framework/Drupal8.php \Drupal\realistic_dummy_content_api\Framework\Drupal8::hookEntityPresave()
File
- api/
src/ Framework/ Drupal8.php, line 32
Class
- Drupal8
- Drupal 8-specific code.
Namespace
Drupal\realistic_dummy_content_api\FrameworkCode
public function hookEntityPresave($entity, $type) {
try {
// $type is NULL in Drupal8; we'll compute it here.
$type = $this
->getEntityType($entity);
if (realistic_dummy_content_api_is_dummy($entity, $type)) {
$candidate = $entity;
realistic_dummy_content_api_improve_dummy_content($candidate, $type);
realistic_dummy_content_api_validate($candidate, $type);
$entity = $candidate;
}
} catch (Exception $e) {
$this
->setMessage(t('realistic_dummy_content_api failed to modify dummy objects: message: @m', array(
'@m' => $e
->getMessage(),
)), 'error', FALSE);
}
}