Introduce theme negotiator for mail and use it in mail manager

Created on 7 November 2024, about 2 months ago

Problem/Motivation

Part of 🌱 [META] Adopt the symfony mailer component Needs review but benefits the current mail system as well. Also see #2621018: Support rendering from a manually specified theme β†’ for why we need this no matter how the mail building part is going to look in the future.

Steps to reproduce

Proposed resolution

  1. Add a Drupal\Core\MailTheme\MailThemeManager with one method: executeInMailTheme(string $emailId, callable $function)
  2. Add Drupal\Core\MailTheme\MailThemeNegotiator which works analogous to theme negotiation
  3. Add Drupal\Core\MailTheme\DefaultNegotiator with a low priority which falls back to the configured theme.
  4. Switch the theme before building / sending mails from within plugin.manager.mail

This is basically cherry-picking from contrib Mailsystem β†’ and Drupal Symfony Mailer β†’ respectively.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

πŸ“Œ Task
Status

Active

Version

11.1 πŸ”₯

Component

mail system

Created by

πŸ‡¨πŸ‡­Switzerland znerol

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024