You are here

function geolocation_demo_uninstall in Geolocation Field 8.2

Same name and namespace in other branches
  1. 8.3 modules/geolocation_demo/geolocation_demo.install \geolocation_demo_uninstall()
  2. 8 modules/geolocation_demo/geolocation_demo.install \geolocation_demo_uninstall()

Implements hook_uninstall().

File

modules/geolocation_demo/geolocation_demo.install, line 141
Geolocation demo setup.

Code

function geolocation_demo_uninstall() {
  $taxonomy_storage = \Drupal::entityTypeManager()
    ->getStorage('taxonomy_term');
  $node_storage = \Drupal::entityTypeManager()
    ->getStorage('node');
  $taxonomy_storage
    ->delete($taxonomy_storage
    ->loadByProperties([
    'vid' => 'geolocation_demo_taxonomy',
  ]));
  $node_storage
    ->delete($node_storage
    ->loadByProperties([
    'type' => 'geolocation_default_article',
  ]));
  foreach ([
    'field_geolocation_demo_single',
    'field_geolocation_demo_multiple',
    'field_geolocation_demo_taxonomy',
  ] as $field_storage_name) {
    $field_storage = FieldStorageConfig::loadByName('node', $field_storage_name);
    if ($field_storage) {
      $field_storage
        ->delete();
    }
  }
  field_purge_batch(100);
}