Problem/Motivation

When trying to send html emails, they always come through with the html escaped. I'll attach my current patch for this issue.

Steps to reproduce

- Enable the PF Email module.
- Setup ECA (or any other system) that will trigger an email through Push Framework
- Go to /admin/config/system/push_framework and set the text format to an HTML enabled format.
- Trigger the action setup above.

CommentFileSizeAuthor
#2 3387056-1.patch825 bytesj_ten_man
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

j_ten_man created an issue. See original summary.

j_ten_man’s picture

StatusFileSize
new825 bytes

Patch attached.

The issue stems from the fact that the ChannelPostRender event casts the $output variable to a string, so we lose the Markup class on it.

jurgenhaas’s picture

Great finding @j_ten_man, thanks for reporting this. Wouldn't it be better, to avoid casting in the first place? I mean, we could update the ChannelPostRender event such that the output variable accepts either string or Markup so that we never even loose context. What do you think?

When we continue working on this, please turn this into an issue fork with a merge request. Patches will no longer work soon, so we've already changed workflow to MRs, which is much more convenient for development, review and everything else.

j_ten_man’s picture

Potentially that's a better solution - it allows other event subscribers to correctly handle the text that way. I wasn't sure of other unintended consequences of doing it that way as it would potentially be an API change, and this solution was good enough for my needs.

thomas bosviel’s picture

Version: 2.2.x-dev » 2.3.x-dev
Assigned: Unassigned » thomas bosviel

jurgenhaas’s picture

Not sure, if this is already ready for review, since the issue status doesn't indicate that yet. But from what I can see in the MR so far, I wouldn't remove the string type, instead we should declare string|MarkupInterface as the possible types for output, as this is as strict as we can get in this case. And I love strict types ;-)

thomas bosviel’s picture

Status: Active » Needs review

I agree, much better solution. Thanks

jurgenhaas’s picture

Assigned: thomas bosviel » Unassigned
Status: Needs review » Fixed
Issue tags: +ContributionWeekend2025

Thanks everyone, just merged this one.

Status: Fixed » Closed (fixed)

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