Skip to content
Snippets Groups Projects
Commit c98e7968 authored by Adam Shepherd's avatar Adam Shepherd Committed by Adam Shepherd
Browse files

Issue #3349697 by AdamPS: Only call one EmailBuilder

parent 240e9f23
No related branches found
No related tags found
No related merge requests found
...@@ -84,16 +84,14 @@ class EmailFactory implements EmailFactoryInterface { ...@@ -84,16 +84,14 @@ class EmailFactory implements EmailFactoryInterface {
* The email. * The email.
*/ */
protected function initEmail(EmailInterface $email, ...$params) { protected function initEmail(EmailInterface $email, ...$params) {
// Load builders with matching ID. // Load the best-matching builder.
foreach ($email->getSuggestions('', '.') as $plugin_id) { foreach ($email->getSuggestions('', '.') as $plugin_id) {
if ($this->emailBuilderManager->hasDefinition($plugin_id)) { if ($this->emailBuilderManager->hasDefinition($plugin_id)) {
/** @var \Drupal\symfony_mailer\Processor\EmailBuilderInterface $builder */ /** @var \Drupal\symfony_mailer\Processor\EmailBuilderInterface $builder */
$builder = $this->emailBuilderManager->createInstance($plugin_id); $builder = $this->emailBuilderManager->createInstance($plugin_id);
if (empty($created)) { $builder->createParams($email, ...$params);
$builder->createParams($email, ...$params);
$created = TRUE;
}
$builder->init($email); $builder->init($email);
break;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment