You are here

function forward_uninstall in Forward 8

Same name and namespace in other branches
  1. 8.3 forward.install \forward_uninstall()
  2. 8.2 forward.install \forward_uninstall()
  3. 5 forward.install \forward_uninstall()
  4. 6 forward.install \forward_uninstall()
  5. 7.3 forward.install \forward_uninstall()
  6. 7 forward.install \forward_uninstall()
  7. 7.2 forward.install \forward_uninstall()
  8. 4.x forward.install \forward_uninstall()
  9. 4.0.x forward.install \forward_uninstall()

Implements hook_uninstall().

File

./forward.install, line 41
Install, update and uninstall functions for the forward module.

Code

function forward_uninstall() {

  // Clear default values for config which require dynamic values.
  \Drupal::configFactory()
    ->getEditable('forward.settings')
    ->clear('forward_email_from_address')
    ->save();

  // Remove the Forward mail plugin
  $config = \Drupal::configFactory()
    ->getEditable('system.mail');
  $mail_plugins = $config
    ->get('interface');
  unset($mail_plugins['forward_send_entity']);
  $config
    ->set('interface', $mail_plugins)
    ->save();

  // Remove the custom view mode
  $view_mode = EntityViewMode::load('node.forward');
  if ($view_mode) {
    $view_mode
      ->delete();
  }

  // Remove the Forward logs view
  $view = \Drupal::service('entity_type.manager')
    ->getStorage('view')
    ->load('forward_logs');
  if ($view) {
    $view
      ->delete();
  }

  // Remove the Forward statistics view
  $view = \Drupal::service('entity_type.manager')
    ->getStorage('view')
    ->load('forward_statistics');
  if ($view) {
    $view
      ->delete();
  }
}