You are here

function template_preprocess_simplenews_field in Simplenews 7.2

Same name and namespace in other branches
  1. 7 simplenews.module \template_preprocess_simplenews_field()

@todo

See also

template_preprocess_field()

theme_simplenews_field()

File

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

Code

function template_preprocess_simplenews_field(&$variables, $hook) {
  $element = $variables['element'];
  $variables['label_hidden'] = $element['#label_display'] == 'hidden';
  $variables['label'] = $variables['label_hidden'] ? NULL : check_plain($element['#title']);
  $variables['items'] = array();
  foreach ($element['#items'] as $delta => $item) {
    if (!empty($element[$delta])) {
      $variables['items'][$delta] = $element[$delta];
    }
  }
  $variables['view_mode'] = $variables['element']['#view_mode'];

  // Add specific suggestions that can override the default implementation.
  $variables['theme_hook_suggestions'] = array(
    'simplenews_field__' . $element['#field_name'],
    'simplenews_field__' . $element['#view_mode'],
    'simplenews_field__' . $element['#field_name'] . '__' . $element['#view_mode'],
  );
}