You are here

function access_unpublished_entity_delete in Access unpublished 8

Implements hook_entity_delete().

File

./access_unpublished.module, line 62
Contains access_unpublished implementations.

Code

function access_unpublished_entity_delete(EntityInterface $entity) {

  /** @var \Drupal\access_unpublished\AccessTokenManager $tokenManager */
  $tokenManager = \Drupal::service('access_unpublished.access_token_manager');
  foreach ($tokenManager
    ->getAccessTokensByEntity($entity) as $token) {
    $token
      ->delete();
  }
}