function google_map_field_requirements in Google Map Field 8
Same name and namespace in other branches
- 7.2 google_map_field.install \google_map_field_requirements()
Implements hook_requirements().
File
- ./
google_map_field.install, line 14 - Contains google_map_field.install.
Code
function google_map_field_requirements($phase) {
$requirements = [];
// Whether or not an API key or client id is provided.
$key_provided = FALSE;
$config = \Drupal::config('google_map_field.settings');
$settings = $config
->get();
if (isset($settings['google_map_field_auth_method'])) {
switch ($settings['google_map_field_auth_method']) {
case 1:
if (!empty($settings['google_map_field_apikey'])) {
$key_provided = TRUE;
}
break;
case 2:
if (!empty($settings['google_map_field_map_client_id'])) {
$key_provided = TRUE;
}
break;
}
}
if (!$key_provided) {
$requirements['google_map_field'] = [
'title' => t('Google map field'),
'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>', [
'@link' => 'http://googlegeodevelopers.blogspot.ca/2016/06/building-for-scale-updates-to-google.html',
]),
];
}
return $requirements;
}