You are here

function theme_scs_newsletter_output in Simplenews Content Selection 7

Same name and namespace in other branches
  1. 6.2 scs.theme.inc \theme_scs_newsletter_output()

Theme a complete newsletter, appending each node rendered through theme_scs_node_output() and appending ToC if required

Parameters

$variables Array An array containing 'nodes' and 'toc':

1 theme call to theme_scs_newsletter_output()
_scs_create_newsletter in ./scs.module
Newsletter creator function

File

./scs.theme.inc, line 83
Select Drupal content to create a newsletter

Code

function theme_scs_newsletter_output($variables) {
  $body = '';
  $titles = array();

  // Node information
  foreach ($variables['nodes'] as $node) {
    if ($variables['toc']) {
      if (variable_get('scs_format', 'plain') == 'plain') {
        $titles[] = $node->title;
      }
      else {
        $titles[] = '<a href="#node_' . $node->nid . '">' . $node->title . '</a>';
      }
    }
    $body .= theme('scs_node_output', (array) $node);
  }

  // ToC (if required)
  if ($variables['toc']) {
    $body = theme('scs_node_titles', array(
      'titles' => $titles,
    )) . $body;
  }

  // Complete newsletter body
  return $body;
}