You are here

function template_preprocess_simplenews_newsletter_body in Simplenews 7

Same name and namespace in other branches
  1. 8.2 simplenews.module \template_preprocess_simplenews_newsletter_body()
  2. 8 simplenews.module \template_preprocess_simplenews_newsletter_body()
  3. 6.2 simplenews.module \template_preprocess_simplenews_newsletter_body()
  4. 6 simplenews.module \template_preprocess_simplenews_newsletter_body()
  5. 7.2 simplenews.module \template_preprocess_simplenews_newsletter_body()
  6. 3.x simplenews.module \template_preprocess_simplenews_newsletter_body()

Process variables to format the simplenews newsletter body.

See also

simplenews-newsletter-body.tpl.php

File

./simplenews.module, line 2490
Simplenews node handling, sent email, newsletter block and general hooks

Code

function template_preprocess_simplenews_newsletter_body(&$variables) {

  // We don't want to include links and comments in the email.
  unset($variables['build']['links']);
  unset($variables['build']['comments']);
  $theme = function_exists('mailsystem_get_mail_theme') ? mailsystem_get_mail_theme() : path_to_theme();
  $variables['simplenews_theme'] = drupal_get_path('theme', $theme);
  $variables['title'] = check_plain($variables['build']['#node']->title);
  $variables['language'] = $variables['build']["#language"];
  $variables['view_mode'] = $variables['build']['#view_mode'];

  // Add specific suggestions that can override the default implementation.
  $variables['theme_hook_suggestions'] = array(
    'simplenews_newsletter_body__' . $variables['category']->tid,
    'simplenews_newsletter_body__' . $variables['build']['#view_mode'],
    'simplenews_newsletter_body__' . $variables['category']->tid . '__' . $variables['build']['#view_mode'],
  );
}