You are here

function content_access_entity_delete in Content Access 8

Implements hook_entity_delete().

File

./content_access.module, line 180
Content access module file.

Code

function content_access_entity_delete(EntityInterface $entity) {
  $config = \Drupal::configFactory()
    ->getEditable('content_access.settings');
  if ($entity instanceof RoleInterface) {
    $roles_gids = $config
      ->get('content_access_roles_gids');
    unset($roles_gids[$entity
      ->id()]);
    $config
      ->set('content_access_roles_gids', $roles_gids)
      ->save();
  }
}