public function EntityHook::onEntityDelete in Editor Notes 8
Delete Editor Note on entity delete.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: Entity object.
See also
editor_note_entity_delete
File
- src/
Hook/ EntityHook.php, line 91
Class
- EntityHook
- Be aware of some entity hooks to perform actions on editor note.
Namespace
Drupal\editor_note\HookCode
public function onEntityDelete(EntityInterface $entity) {
$notes = $this->entityTypeManager
->getStorage('editor_note')
->loadByProperties([
'bundle' => $entity
->bundle(),
'entity_id' => $entity
->id(),
]);
foreach ($notes as $note) {
$note
->delete();
}
}