You are here

function geolocation_demo_uninstall in Geolocation Field 8

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

Implements hook_uninstall().

File

modules/geolocation_demo/geolocation_demo.install, line 148
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',
  ]));

  /** @var \Drupal\Core\Config\Config $config */
  $config = \Drupal::service('config.factory')
    ->getEditable('geolocation.settings');
  if ($config
    ->get('google_map_api_key') == 'AIzaSyCkfb6CGBKdkkYcYni9WSqp6bGad_5lZi4') {
    $config
      ->set('google_map_api_key', '')
      ->save();
  }
}