Pass mail subject to the twig files as variable

Created on 12 June 2023, over 1 year ago
Updated 19 June 2023, over 1 year ago

Problem/Motivation

In the past, using Swiftmailer, we used to display the mail subject as headline in the emails, below the title image.
This currently doesn't seem possible using Drupal Symfony Mailer, as the subject isn't passed to the twig files.

Could this be passed as {{ subject }} again in the future? I guess it might not only help us.

Thank you.

Steps to reproduce

Proposed resolution

Pass {{ subject }} to both twig files:

/**
 * Implements hook_theme().
 */
function symfony_mailer_theme($existing, $type, $theme, $path) {
  return [
    'email' => [
      'variables' => [
        'email' => NULL,
        'subject' => NULL,
      ],
      'mail theme' => TRUE,
    ],
    'email_wrap' => [
      'variables' => [
        'email' => NULL,
        'subject' => NULL,
        'body' => '',
        'is_html' => TRUE,
      ],
    ],
  ];
}

Remaining tasks

User interface changes

API changes

Data model changes

Feature request
Status

Fixed

Version

1.0

Component

Code

Created by

🇩🇪Germany Anybody Porta Westfalica

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

Comments & Activities

Production build 0.71.5 2024