You are here

styled_google_map.install in Styled Google Map 8

Same filename and directory in other branches
  1. 8.2 styled_google_map.install
  2. 7.2 styled_google_map.install

File

styled_google_map.install
View source
<?php

/**
 * Implementation of hook_requirements().
 */
function styled_google_map_requirements($phase) {
  $requirements = array();

  // Whether or not an API key or client id is provided.
  $key_provided = FALSE;
  $config = \Drupal::config('styled_google_map.settings');
  switch ($config
    ->get('styled_google_map_google_auth_method')) {
    case STYLED_GOOGLE_MAP_GOOGLE_AUTH_KEY:
      $key = $config
        ->get('styled_google_map_google_apikey', FALSE);
      if ($key) {
        $key_provided = TRUE;
      }
      break;
    case STYLED_GOOGLE_MAP_GOOGLE_AUTH_WORK:
      $client_id = $config
        ->get('styled_google_map_google_client_id', FALSE);
      if ($client_id) {
        $key_provided = TRUE;
      }
      break;
  }
  if (!$key_provided) {
    $requirements['styled_google_map'] = array(
      'title' => t('Styled Google Map'),
      'severity' => REQUIREMENT_WARNING,
      'value' => t('Google Maps API key or Client ID was not found. As of 2016/06/22, keyless access is no longer supported and it may impact rendering of maps. For more information visit: <a href="@link">@link</a>', array(
        '@link' => 'http://googlegeodevelopers.blogspot.ca/2016/06/building-for-scale-updates-to-google.html',
      )),
    );
  }
  return $requirements;
}

Functions

Namesort descending Description
styled_google_map_requirements Implementation of hook_requirements().