You are here

function group_entity_delete in Group 8

Same name and namespace in other branches
  1. 7 group.entity.inc \group_entity_delete()
  2. 2.0.x group.module \group_entity_delete()

Implements hook_entity_delete().

File

./group.module, line 361
Allows you to group users, content and other entities.

Code

function group_entity_delete(EntityInterface $entity) {
  if ($entity instanceof ContentEntityInterface) {
    if ($group_contents = GroupContent::loadByEntity($entity)) {

      /** @var \Drupal\group\Entity\GroupContent $group_content */
      foreach ($group_contents as $group_content) {
        $group_content
          ->delete();
      }
    }
  }
}