function geolocation_yandex_requirements in Geolocation Field 8.3
Same name and namespace in other branches
- 8.2 modules/geolocation_yandex/geolocation_yandex.install \geolocation_yandex_requirements()
Implements hook_requirements().
File
- modules/
geolocation_yandex/ geolocation_yandex.install, line 15 - Handle requirements.
Code
function geolocation_yandex_requirements($phase) {
$requirements = [];
if ($phase == 'runtime') {
$requirements['geolocation_yandex_api_key'] = [
'title' => t('Geolocation - Yandex Maps API Key'),
'value' => t('Yandex Maps API key set'),
'description' => t('A Yandex Maps API key is set in the <a href=":geolocation_yandex_settings_url">Geolocation settings</a>.', [
':geolocation_yandex_settings_url' => Url::fromRoute('geolocation_yandex.settings')
->toString(),
]),
'severity' => REQUIREMENT_OK,
];
if (empty(\Drupal::config('geolocation_yandex.settings')
->get('api_key'))) {
$requirements['geolocation_yandex_api_key']['value'] = t('Yandex maps API key missing');
$requirements['geolocation_yandex_api_key']['description'] = t('A Yandex maps API key is missing in the <a href=":geolocation_yandex_settings_url">Geolocation settings</a>.', [
':geolocation_yandex_settings_url' => Url::fromRoute('geolocation_yandex.settings')
->toString(),
]);
$requirements['geolocation_yandex_api_key']['severity'] = REQUIREMENT_WARNING;
}
}
return $requirements;
}