You are here

function webform_modules_uninstalled in Webform 6.x

Same name and namespace in other branches
  1. 8.5 webform.module \webform_modules_uninstalled()

Implements hook_modules_uninstalled().

File

./webform.module, line 101
Enables the creation of webforms and questionnaires.

Code

function webform_modules_uninstalled($modules) {

  // Remove uninstalled module's third party settings from admin settings.
  $config = \Drupal::configFactory()
    ->getEditable('webform.settings');
  $third_party_settings = $config
    ->get('third_party_settings');
  $has_third_party_settings = FALSE;
  foreach ($modules as $module) {
    if (isset($third_party_settings[$module])) {
      $has_third_party_settings = TRUE;
      unset($third_party_settings[$module]);
    }
  }
  if ($has_third_party_settings) {
    $config
      ->set('third_party_settings', $third_party_settings);
    $config
      ->save();
  }

  // Check HTML email provider support as modules are uninstalled.

  /** @var \Drupal\webform\WebformEmailProviderInterface $email_provider */
  $email_provider = \Drupal::service('webform.email_provider');
  $email_provider
    ->check();
}