public static function Loqate::getApiKey in Loqate 2.x
Same name and namespace in other branches
- 8 src/Loqate.php \Drupal\loqate\Loqate::getApiKey()
Gets the Loqate API key value.
Parameters
null $key_id: Optional custom key module key id.
Return value
string|null The key value if found or NULL.
2 calls to Loqate::getApiKey()
- PcaAddressElementTrait::preparePcaOptions in src/
PcaAddressElementTrait.php - Processes additional options and overrides.
- WebformAddressLoqate::preRenderWebformCompositeFormElement in modules/
pca_webform/ src/ Element/ WebformAddressLoqate.php - Adds form element theming to an element if its title or description is set.
File
- src/
Loqate.php, line 23
Class
- Loqate
- Class Loqate.
Namespace
Drupal\loqateCode
public static function getApiKey($key_id = NULL) {
if ($key_id === NULL) {
$key_id = \Drupal::config('loqate.loqateapikeyconfig')
->get(LoqateApiKeyConfigForm::DEFAULT_API_KEY);
}
if ($key_id) {
/** @var \Drupal\key\KeyRepositoryInterface $key_repository */
$key_repository = \Drupal::service('key.repository');
$key_entity = $key_repository
->getKey($key_id);
if ($key_entity) {
return $key_entity
->getKeyValue();
}
}
return NULL;
}