You are here

function template_preprocess_simplenews_status in Simplenews 6

Same name and namespace in other branches
  1. 6.2 includes/simplenews.admin.inc \template_preprocess_simplenews_status()

Process variables to format the simplenews status indication.

$variables contains:

  • $source
  • $status

See also

simplenews-status.tpl.php

theme_simplenews_status()

File

./simplenews.admin.inc, line 1222
Newsletter admin, subscription admin, simplenews settings

Code

function template_preprocess_simplenews_status(&$variables) {
  switch ($variables['source']) {
    case 'published':
      $images = array(
        0 => 'sn-saved.png',
        1 => 'sn-sent.png',
      );
      $title = array(
        0 => t('Not published'),
        1 => t('Published'),
      );
      break;
    case 'activated':
      $images = array(
        0 => 'sn-saved.png',
        1 => 'sn-sent.png',
      );
      $title = array(
        0 => t('Inactive: no newsletters will be sent'),
        1 => t('Active: user will receive newsletters'),
      );
      break;
    case 'sent':
      $images = array(
        SIMPLENEWS_STATUS_SEND_NOT => 'sn-saved.png',
        SIMPLENEWS_STATUS_SEND_PENDING => 'sn-cron.png',
        SIMPLENEWS_STATUS_SEND_READY => 'sn-sent.png',
      );
      $title = array(
        SIMPLENEWS_STATUS_SEND_NOT => t('Not sent'),
        SIMPLENEWS_STATUS_SEND_PENDING => t('Currently sending by cron'),
        SIMPLENEWS_STATUS_SEND_READY => t('Sent'),
      );
      break;
  }

  // Build the variables
  $variables['image'] = base_path() . drupal_get_path('module', 'simplenews') . '/' . $images[$variables['status']];
  $variables['alt'] = $variables['title'] = $title[$variables['status']];
}