You are here

function htmlmail_install in HTML Mail 8

Same name and namespace in other branches
  1. 8.3 htmlmail.install \htmlmail_install()
  2. 8.2 htmlmail.install \htmlmail_install()
  3. 6.2 htmlmail.install \htmlmail_install()
  4. 7.2 htmlmail.install \htmlmail_install()
  5. 7 htmlmail.install \htmlmail_install()

Implements hook_install().

File

./htmlmail.install, line 11
Installation for HTML Mail module.

Code

function htmlmail_install() {
  $config = \Drupal::configFactory()
    ->getEditable('system.mail');
  $mail_plugins = $config
    ->get('interface');
  if (in_array('htmlmail', array_keys($mail_plugins))) {
    return;
  }
  $mail_plugins['htmlmail'] = 'HTMLMailMailSystem';
  $config
    ->set('interface', $mail_plugins)
    ->save();
  $config = \Drupal::configFactory()
    ->getEditable('mailsystem.settings');
  $config
    ->set('defaults.sender', 'htmlmail')
    ->set('defaults.formatter', 'htmlmail')
    ->save();
}