Problem/Motivation

Modifications in hook_mail_alter like .e.g adding extra parameters to the message, should be available in the email.html.twig template, but they aren't because the legacy_message parameter is set before hook_mail_alter is invoked.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

jeroent created an issue. See original summary.

jeroent’s picture

Issue summary: View changes
Status: Needs work » Needs review
adamps’s picture

Status: Needs review » Needs work

Patch doesn't seem to work against 2.x

adamps’s picture

Issue tags: +Needs reroll, +Novice
adamps’s picture

Title: LegacyEmailBuilder doesn't allow changes in the legacy_message, made during an hook_mail_alter(). » Parameters missing for legacy emails
Issue tags: -Needs reroll

AFAICS that patch will make the parameters available contained in the legacy_message param - which works I guess, but isn't what I'd recommend. In my view the legacy_message param is an implementation detail of LegacyMailer and isn't part of the interface. Instead all the information from $message should be available via $email.

The legacy parameters should be available directly via getParams(), but they are missing. We can do that in LegacyMailerHelper::emailFromArray() something like this

// Parameters.
$email->setParams($message['params'])

adamps changed the visibility of the branch 3487274-1.5 to hidden.

adamps’s picture

Status: Needs work » Fixed
Issue tags: -Novice

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.