You are here

function imagezoom_field_formatter_view in Image Zoom 7

Same name and namespace in other branches
  1. 7.2 imagezoom.module \imagezoom_field_formatter_view()

Implements hook_field_formatter_view().

File

./imagezoom.module, line 120
Provides an Image Zoom field formatter for Image fields.

Code

function imagezoom_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
  $display_style = $display['settings']['imagezoom_display_style'];
  $zoom_style = $display['settings']['imagezoom_zoom_style'];
  $thumb_style = isset($display['settings']['imagezoom_thumb_style']) ? $display['settings']['imagezoom_thumb_style'] : NULL;
  $element = array();
  if (variable_get('imagezoom_multiple_thumbs', 0) && count($items) > 1) {
    $element[] = array(
      '#theme' => 'imagezoom_image_multiple',
      '#items' => $items,
      '#display_style' => $display_style,
      '#zoom_style' => $zoom_style,
      '#thumb_style' => $thumb_style,
    );
  }
  else {
    foreach ($items as $delta => $item) {
      $element[$delta] = array(
        '#theme' => 'imagezoom_image',
        '#item' => $item,
        '#display_style' => $display_style,
        '#zoom_style' => $zoom_style,
      );
    }
  }
  return $element;
}