function opigno_group_manager_entity_delete in Opigno group manager 8
Same name and namespace in other branches
- 3.x opigno_group_manager.module \opigno_group_manager_entity_delete()
Implements hook_entity_delete().
File
- ./
opigno_group_manager.module, line 274 - Contains opigno_group_manager.module.
Code
function opigno_group_manager_entity_delete(EntityInterface $entity) {
if ($entity instanceof GroupInterface) {
try {
/* @var \Drupal\opigno_group_manager\Entity\OpignoGroupManagedContent[] $opigno_group_managed_contents */
$opigno_group_managed_contents = OpignoGroupManagedContent::loadByGroupId($entity
->id());
if (count($opigno_group_managed_contents)) {
foreach ($opigno_group_managed_contents as $opigno_group_managed_content) {
$opigno_group_managed_content
->delete();
}
}
} catch (PluginNotFoundException|InvalidPluginDefinitionException|EntityStorageException $e) {
watchdog_exception('opigno_group_manager', $e);
}
}
}