Element translation not loaded when changing config override language

Created on 7 September 2023, 9 months ago
Updated 14 September 2023, 9 months ago

Problem/Motivation

When trying to send remidner emails via the ScheduleEmailWebormHandler the email would not get send and the following error would be loggeded Email not sent for Scheduled email handler because a To, CC, or BCC email was not provided

That's because in \Drupal\webform\Entity\Webform::initElementsTranslation we check if the webform's language is the same as current language and if it is, translations are not initiated, which results in an empty element type value and \Drupal\webform\Plugin\WebformElementManager::invokeMethod then skips sending.

Steps to reproduce

  1. Multilingual site, default language German, additional language French.
  2. Create a webform that has an email field.
  3. Create an email handler that uses the schedule email handler. Use the email field as To. Set the Send on to something testable (Current date, Custom date,...)
  4. Translate the form to French.
  5. Create a test submission using the French translation
  6. Run drush webform:scheduled-email:cron

This should result in the mentioned error and no emails sent.

Proposed resolution

Change how current language is fetched.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

6.1

Component

Code

Created by

🇸🇮Slovenia Primsi

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024