Bug #92881
closed
FluidEmail not rendered for getHtmlBody()
Added by Mathias Brodala about 4 years ago.
Updated about 2 years ago.
Description
Currently the FluidEmail
added with #90266 triggers rendering of its text and HTML body only on getBody()
call. When calling getHtmlBody()
instead, no rendering is triggered. Calling getHtmlBody()
after calling getBody()
will return the rendered HTML body of course.
This needs to be fixed so that each body getter renders its own part.
- Status changed from New to Needs Feedback
Hi, IMO this is the correct behaviour. getBody()
is actually implemented in FluidEmail
to generate the the body (text / html or both) by rendering the fluid template and assigning the result to the parent class variables ($html / $text) depending on the selected $format
. The getHtmlBody
and its counterpart getTextBody
are just getters of the underlying Symfony\Component\Mime\Email
component, which do not relate to any fluid rendering, but instead just return the current value of the corresponding class variables. Therefore those can only return the rendered part, when the getBody
implementation had been called beforehand.
What exactly is your use case here? Do you need the ability to define just one format to be rendered? This would be possible using the ->format()
method.
Would it help if we would implement getHtmlBody() and getTextBody() to generate their corresponding content?
Oliver Bartsch wrote in #note-4:
Would it help if we would implement getHtmlBody() and getTextBody() to generate their corresponding content?
Sure, that's what this ticket is about. ;-)
- Status changed from Needs Feedback to Under Review
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
- Status changed from Resolved to Closed
Also available in: Atom
PDF