class KeyProvider in Geolocation Field 8.3
Class KeyProvider.
@package Drupal\geolocation
Hierarchy
- class \Drupal\geolocation\KeyProvider
Expanded class hierarchy of KeyProvider
4 files declare their use of KeyProvider
- Geocodio.php in modules/
geolocation_geocodio/ src/ Plugin/ geolocation/ Geocoder/ Geocodio.php - GoogleGeocodingAPI.php in modules/
geolocation_google_maps/ src/ Plugin/ geolocation/ Geocoder/ GoogleGeocodingAPI.php - GoogleMapsProviderBase.php in modules/
geolocation_google_maps/ src/ GoogleMapsProviderBase.php - GooglePlacesAPI.php in modules/
geolocation_google_maps/ modules/ geolocation_google_places_api/ src/ Plugin/ geolocation/ Geocoder/ GooglePlacesAPI.php
File
- src/
KeyProvider.php, line 10
Namespace
Drupal\geolocationView source
class KeyProvider {
/**
* Get actual API key from key module, if possible.
*
* So that we don't need to store plain text api key secrets in config file.
*/
public static function getKeyValue($api_key) {
if (empty($api_key)) {
return $api_key;
}
// If the "Key" module exists, assume we are storing the key name instead of
// the actual value, which should be a secret not saved in config.
if (!\Drupal::moduleHandler()
->moduleExists('key')) {
return $api_key;
}
$store = \Drupal::service('key.repository')
->getKey($api_key);
if (empty($store)) {
return $api_key;
}
$store_key = $store
->getKeyValue();
if (empty($store_key)) {
return $api_key;
}
return $store_key;
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
KeyProvider:: |
public static | function | Get actual API key from key module, if possible. |