public function YamlFormEmailProvider::check in YAML Form 8
Check if the YAML Form module should provide support for sending HTML emails.
Overrides YamlFormEmailProviderInterface::check
File
- src/
YamlFormEmailProvider.php, line 66
Class
- YamlFormEmailProvider
- Manages and provides HTML email support.
Namespace
Drupal\yamlformCode
public function check() {
// Don't override the system.mail.interface.yamlform 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->moduleHandler
->moduleExists($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();
}
}