You are here

function htmlmail_uninstall in HTML Mail 8

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

Implements hook_uninstall().

File

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

Code

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