You are here

geolocation_test_views.install in Geolocation Field 8.2

Geolocation test setup.

File

tests/modules/geolocation_test_views/geolocation_test_views.install
View source
<?php

/**
 * @file
 * Geolocation test setup.
 */

/**
 * Implements hook_install().
 */
function geolocation_test_views_install() {

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

/**
 * Implements hook_uninstall().
 */
function geolocation_test_views_uninstall() {

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