public function WebformEmailProvider::check in Webform 8.5
Same name and namespace in other branches
- 6.x src/WebformEmailProvider.php \Drupal\webform\WebformEmailProvider::check()
Check if the Webform module should provide support for sending HTML emails.
Overrides WebformEmailProviderInterface::check
File
- src/
WebformEmailProvider.php, line 66
Class
- WebformEmailProvider
- Manages and provides HTML email support.
Namespace
Drupal\webformCode
public function check() {
// Don't override the system.mail.interface.webform if the default interface
// is the 'test_mail_collector'.
if ($this->configFactory
->get('system.mail')
->get('interface.default') === 'test_mail_collector') {
return $this
->uninstall();
}
// Check if a contrib module is handling sending email.
$mail_modules = $this
->getModules();
foreach ($mail_modules as $module) {
if ($this
->moduleEnabled($module)) {
return $this
->uninstall();
}
}
// Finally, check if the default mail interface and see if it still uses the
// php_mail. This check allow unknown contrib modules to handle sending
// HTML emails.
if ($this->configFactory
->get('system.mail')
->get('interface.default') === 'php_mail') {
return $this
->install();
}
else {
return $this
->uninstall();
}
}