You are here

function theme_simplenews_field in Simplenews 7

Same name and namespace in other branches
  1. 7.2 simplenews.module \theme_simplenews_field()

File

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

Code

function theme_simplenews_field($variables) {
  $output = '';
  switch ($variables['view_mode']) {
    case 'email_plain':
    case 'email_textalt':

      // Render the label, if it's not hidden.
      if (!$variables['label_hidden']) {
        $output .= $variables['label'] . ":\n";
      }

      // Render the items.
      foreach ($variables['items'] as $item) {
        $output .= drupal_render($item) . "\n";
      }

      // Add an extra line break at the end of the field.
      $output .= "\n";
      break;
    case 'email_html':
    default:

      // Render the label, if it's not hidden.
      if (!$variables['label_hidden']) {
        $output .= '<div class="field-label">' . $variables['label'] . ':&nbsp;</div>';
      }

      // Render the items.
      $output .= '<div class="field-items">';
      foreach ($variables['items'] as $delta => $item) {
        $classes = 'field-item ' . ($delta % 2 ? 'odd' : 'even');
        $output .= '<div class="' . $classes . '">' . drupal_render($item) . '</div>';
      }
      $output .= '</div>';

      // Render the top-level DIV.
      $output = '<div class="clearfix">' . $output . '</div>';
      break;
  }
  return $output;
}