You are here

function template_preprocess_simplenews_newsletter_body in Simplenews 7.2

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 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 2566
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']);
  $entity_type = $variables['build']['#entity_type'];
  $entity = !empty($variables['build']['#' . $entity_type]) ? $variables['build']['#' . $entity_type] : $variables['build']['#entity'];
  $theme = function_exists('mailsystem_get_mail_theme') ? mailsystem_get_mail_theme() : path_to_theme();
  $variables['simplenews_theme'] = drupal_get_path('theme', $theme);
  $variables['title'] = entity_label($entity_type, $entity);
  $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['newsletter']->newsletter_id,
    'simplenews_newsletter_body__' . $variables['build']['#view_mode'],
    'simplenews_newsletter_body__' . $variables['newsletter']->newsletter_id . '__' . $variables['build']['#view_mode'],
  );
}