protected function SimplenewsSourceNode::getBodyWithFormat in Simplenews 7
Get the body with the requested format.
Parameters
$format: Either html or plain.
Return value
The rendered mail body as a string.
2 calls to SimplenewsSourceNode::getBodyWithFormat()
- SimplenewsSourceNode::getBody in includes/
simplenews.source.inc - Implements SimplenewsSourceInterface::getBody().
- SimplenewsSourceNode::getPlainBody in includes/
simplenews.source.inc - Implements SimplenewsSourceInterface::getBody().
File
- includes/
simplenews.source.inc, line 717 - Contains SimplenewsSource interface and implementations.
Class
- SimplenewsSourceNode
- Simplenews source implementation based on nodes for a single subscriber.
Code
protected function getBodyWithFormat($format) {
// Switch to correct user and language context.
$this
->setContext();
if ($cache = $this->cache
->get('final', 'body:' . $format)) {
return $cache;
}
$body = $this
->buildBody($format);
// Build message body, replace tokens.
$body = token_replace($body, $this
->getTokenContext(), array(
'sanitize' => FALSE,
));
if ($format == 'plain') {
// Convert HTML to text if requested to do so.
$body = simplenews_html_to_text($body, $this
->getCategory()->hyperlinks);
}
$this->cache
->set('final', 'body:' . $format, $body);
$this
->resetContext();
return $body;
}