You are here

function gauth_entity_delete in Google Auth 8

Implements hook_entity_delete().

File

./gauth.module, line 27
Google Auth Api for drupal.

Code

function gauth_entity_delete(Drupal\Core\Entity\EntityInterface $entity) {
  if ($entity
    ->getEntityType() == 'user') {
    $gauths = Drupal::entityTypeManager()
      ->getStorage('gauth')
      ->loadByProperties(array(
      'uid' => $entity
        ->getOriginalId(),
    ));
    if ($gauths) {
      Drupal::entityTypeManager()
        ->getStorage('gauth')
        ->delete($gauths);
    }
  }
}