You are here

function autoban_ban_uninstall in Automatic IP ban (Autoban) 8

Implements hook_uninstall().

File

modules/autoban_ban/autoban_ban.install, line 11
Install, update and uninstall functions for the Autoban_ban module.

Code

function autoban_ban_uninstall() {

  // Delete autoban entities with ban provider.
  $storage = \Drupal::entityTypeManager()
    ->getStorage('autoban');
  $query = $storage
    ->getQuery();
  $query
    ->condition('provider', 'ban');
  $entity_ids = $query
    ->execute();
  $entities = $storage
    ->loadMultiple($entity_ids);
  $storage
    ->delete($entities);
}