function sendgrid_integration_requirements in SendGrid Integration 8
Same name and namespace in other branches
- 8.2 sendgrid_integration.install \sendgrid_integration_requirements()
- 7 sendgrid_integration.install \sendgrid_integration_requirements()
Implements hook_requirements().
File
- ./
sendgrid_integration.install, line 36 - Contains install and update functions for SendGrid Integration
Code
function sendgrid_integration_requirements($phase) {
$requirements = [];
$config = \Drupal::configFactory()
->get('sendgrid_integration.settings');
switch ($phase) {
case 'runtime':
if (empty($config
->get('apikey'))) {
$requirements['sendgrid_integration'] = [
'title' => t('SendGrid Integration Settings'),
'value' => t('API Key Not Set'),
'severity' => REQUIREMENT_ERROR,
'description' => t('You need to <a href="@url">add a SendGrid API Secret Key</a> for Drupal to be able to deliver mail through SendGrid Integration.', [
'@url' => Url::fromRoute('sendgrid_integration.settings_form')
->toString(),
]),
];
}
else {
$requirements['sendgrid_integration'] = [
'title' => t('SendGrid Integration Settings'),
'severity' => REQUIREMENT_OK,
'value' => t('API Secret Key saved'),
];
}
break;
}
return $requirements;
}