You are here

function template_preprocess_fotorama_gallery_field in Fotorama Gallery 8

Same name and namespace in other branches
  1. 8.2 fotorama_gallery.module \template_preprocess_fotorama_gallery_field()

Implements template_preprocess_fotorama_gallery_field().

File

./fotorama_gallery.module, line 22
Add new formatter display to image field.

Code

function template_preprocess_fotorama_gallery_field(&$variables, $hook) {
  $element = $variables['element'];
  $variables['label_hidden'] = $element['#label_display'] == 'hidden';

  // Always set the field label - allow themes to decide whether to display it.
  // In addition the label should be rendered but hidden to support screen
  // readers.
  $variables['label'] = $element['#title'];
  $variables['multiple'] = $element['#is_multiple'];
  $variables['items'] = [];
  $delta = 0;
  while (!empty($element[$delta])) {
    $variables['items'][$delta]['content'] = $element[$delta];
    $delta++;
  }
  $variables['attributes'] = $variables['element']['attributes'];
}