protected function SimplenewsSourceNode::build in Simplenews 7
Build the node object.
The resulting build array is cached as it is used in multiple places.
Parameters
$format: (Optional) Override the default format. Defaults to getFormat().
3 calls to SimplenewsSourceNode::build()
- SimplenewsSourceNode::buildBody in includes/
simplenews.source.inc - Build the themed newsletter body.
- SimplenewsSourceNode::buildFooter in includes/
simplenews.source.inc - Builds the themed footer.
- SimplenewsSourceNode::getAttachments in includes/
simplenews.source.inc - Implements SimplenewsSourceInterface::getAttachments().
File
- includes/
simplenews.source.inc, line 653 - Contains SimplenewsSource interface and implementations.
Class
- SimplenewsSourceNode
- Simplenews source implementation based on nodes for a single subscriber.
Code
protected function build($format = NULL) {
if (empty($format)) {
$format = $this
->getFormat();
}
if (!empty($this->build[$format])) {
return $this->build[$format];
}
// Build message body
// Supported view modes: 'email_plain', 'email_html', 'email_textalt'
$build = node_view($this->node, 'email_' . $format);
unset($build['#theme']);
foreach (field_info_instances('node', $this->node->type) as $field_name => $field) {
if (isset($build[$field_name])) {
$build[$field_name]['#theme'] = 'simplenews_field';
}
}
$this->build[$format] = $build;
return $this->build[$format];
}