Problem/Motivation
When renderPlain() was introduced, we forgot to update contact_mail() (and maybe other places?) to use renderPlain().
This can be a problem if the contact form is submitted while rendering, in my case, I'm displaying contact forms through an entity reference field.
Proposed resolution
Use renderPlain() instead. Using render() would be wrong, because even if the contact message rendering would add any #attached stuff, we do not want it to end up on the page itself. And we do want to process post render callbacks.
I'm not sure how exactly it should work when you want to send out HTML e-mails, because then you want the #attached stuff to be handled in a separate frame-thingy and put into the HTML mail. But that is a different problem I think.
Remaining tasks
User interface changes
API changes
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | contact-mail-render-plain-2397607-1.patch | 1.3 KB | berdir |
Comments
Comment #1
berdirAnd here is a patch.
Comment #2
berdirMaybe this time ;)
Comment #3
berdirI'm not sure how to test this, as we would need to emulate a scenario where drupal_render_root() fails.
Comment #4
larowlanAgree testing is a bridge too far here
Comment #6
berdirStrange test fail, definitely unrelated:
Comment #8
alexpottThis issue is a normal bug fix, and doesn't include any disruptive changes, so it is allowed per https://www.drupal.org/core/beta-changes.
Committed 794a31d and pushed to 8.0.x. Thanks!