I think I found a bug, but it seems so obvious that I'm wondering if I missed or misconfigured something myself.
When sending a test email from /admin/config/development/reroute_email/test, I got a fatal error: Object of class Drupal\Core\Language\Language could not be converted to string in Drupal\Core\StringTranslation\Translator\CustomStrings->getLanguage(). This seems to be solved by changing a single line in TestEmailForm::submitForm(). Diff:
@@ -103,7 +103,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
$to = $form_state->getValue(['to']);
$param_keys = ['cc', 'bcc', 'subject', 'body'];
$params = array_intersect_key($form_state->getValues(), array_flip($param_keys));
- $langcode = $this->languageManager->getDefaultLanguage();
+ $langcode = $this->languageManager->getDefaultLanguage()->getId();
// Send email with drupal_mail.
$message = $this->mailManager->mail('reroute_email', 'test_email_form', $to, $langcode, $params);
Is this indeed the simple solution to an obvious bug?
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | reroute_email-code_issue-3003536-3-8.6.7.patch | 683 bytes | oleksandr senenko |
Comments
Comment #2
oleksandr senenko commentedComment #3
oleksandr senenko commentedHello.
Thanks Marc for you solution. I implemented it in patch. Tested on Drupal 8.6.7 and Reroute Email 8.x-1.x
Regards.
Comment #4
oleksandr senenko commentedComment #6
bohartCommitted to 8.x-dev version.
Thanks, @all!