Motivation / Problem

When the email goes out and I include some node fields in the message, any fields that are blank in the node do not display properly -- they show the actual replacement pattern, not blank text.

Proposed solution:

Add $option = ['sanitize' => FALSE, 'clear' => TRUE] parameter to the replace method.

CommentFileSizeAuthor
#5 2940507-5.patch865 bytespericxc
#5 interdiff.txt837 bytespericxc
#2 2940507.patch907 bytespericxc

Comments

pericxc created an issue. See original summary.

pericxc’s picture

StatusFileSize
new907 bytes
pericxc’s picture

Status: Active » Needs review
jhedstrom’s picture

+++ b/content_moderation_notifications.module
@@ -54,8 +54,8 @@ function content_moderation_notifications_mail($key, &$message, $params) {
+      $subject = PlainTextOutput::renderFromHtml($token_service->replace($params['subject'], $context, ['sanitize' => FALSE, 'clear' => TRUE]));

sanitize is not a valid option for the replace() method. This looks good if we just use the clear option though.

pericxc’s picture

StatusFileSize
new837 bytes
new865 bytes

  • jhedstrom committed aef6c5e on 8.x-3.x authored by pericxc
    Issue #2940507 by pericxc: Field token is not replaced when fields are...
jhedstrom’s picture

Priority: Major » Normal
Status: Needs review » Fixed

Awesome, thanks!

Status: Fixed » Closed (fixed)

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