function sendgrid_integration_install in SendGrid Integration 8
Same name and namespace in other branches
- 8.2 sendgrid_integration.install \sendgrid_integration_install()
- 7 sendgrid_integration.install \sendgrid_integration_install()
Implements hook_install().
File
- ./
sendgrid_integration.install, line 14 - Contains install and update functions for SendGrid Integration
Code
function sendgrid_integration_install() {
$site_settings = \Drupal::config('system.site');
$config = \Drupal::configFactory()
->getEditable('sendgrid_integration.settings');
// Update defaults for test email.
$config
->set('test_defaults.to', $site_settings
->get('mail'));
$config
->set('test_defaults.body.format', filter_fallback_format());
$config
->save();
// Set the mailsystem for the test email.
$mailsystem_config = \Drupal::configFactory()
->getEditable('mailsystem.settings');
$prefix = MailsystemManager::MAILSYSTEM_MODULES_CONFIG . '.sendgrid_integration.none';
$mailsystem_config
->set($prefix . '.' . MailsystemManager::MAILSYSTEM_TYPE_FORMATTING, 'sendgrid_integration');
$mailsystem_config
->set($prefix . '.' . MailsystemManager::MAILSYSTEM_TYPE_SENDING, 'sendgrid_integration');
$mailsystem_config
->save();
}