function geolocation_here_requirements in Geolocation Field 8.3
Same name and namespace in other branches
- 8.2 modules/geolocation_here/geolocation_here.install \geolocation_here_requirements()
Implements hook_requirements().
File
- modules/
geolocation_here/ geolocation_here.install, line 15 - Handle requirements.
Code
function geolocation_here_requirements($phase) {
$requirements = [];
if ($phase == 'runtime') {
$requirements['geolocation_here_api_key'] = [
'title' => t('Geolocation - HERE Maps Key'),
'value' => t('HERE Maps ID & Code set'),
'description' => t('A HERE Maps key is set in the <a href=":geolocation_here_settings_url">Geolocation settings</a>.', [
':geolocation_here_settings_url' => Url::fromRoute('geolocation_here.settings')
->toString(),
]),
'severity' => REQUIREMENT_OK,
];
if (empty(\Drupal::config('here_maps.settings')
->get('app_id')) || empty(\Drupal::config('here_maps.settings')
->get('app_code'))) {
$requirements['geolocation_here_api_key']['value'] = t('HERE maps ID or code missing');
$requirements['geolocation_here_api_key']['description'] = t('A HERE maps ID or code is missing in the <a href=":geolocation_here_settings_url">Geolocation settings</a>.', [
':geolocation_here_settings_url' => Url::fromRoute('geolocation_here.settings')
->toString(),
]);
$requirements['geolocation_here_api_key']['severity'] = REQUIREMENT_WARNING;
}
}
return $requirements;
}