You are here

function autoban_uninstall in Automatic IP ban (Autoban) 8

Same name and namespace in other branches
  1. 7 autoban.install \autoban_uninstall()

Implements hook_uninstall().

File

./autoban.install, line 11
Install, update and uninstall functions for the Autoban module.

Code

function autoban_uninstall() {

  // Delete all autoban entities.
  $storage = \Drupal::entityTypeManager()
    ->getStorage('autoban');
  $query = $storage
    ->getQuery();
  $entity_ids = $query
    ->execute();
  $entities = $storage
    ->loadMultiple($entity_ids);
  $storage
    ->delete($entities);

  // Delete autoban config settings.
  \Drupal::configFactory()
    ->getEditable('autoban.settings')
    ->delete();
}