You are here

function imagezoomer_field_formatter_view in Image Zoomer 7

Implements hook_field_formatter_view().

File

./imagezoomer.module, line 153
Integrate Powerzoomer / Featuredzoom jquery plugins to Drupal 7

Code

function imagezoomer_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
  $element = array();
  $settings = $display['settings'];
  switch ($display['type']) {
    case 'powerzoomer':
      foreach ($items as $delta => $item) {

        // Prepare variables for inputting into the theme.
        $variables = array(
          'file' => $item,
          'image_style_display' => $settings['imagezoomer_power_image_style_display'],
          'image_style_zooming' => $settings['imagezoomer_power_image_style_zooming'],
          'imagezoomer_power_options' => array(),
        );
        $element[$delta] = array(
          '#markup' => theme('imagezoomer_power_image', $variables),
        );
      }
      break;
    case 'featuredzoomer':
      foreach ($items as $delta => $item) {

        // Prepare variables for inputting into the theme.
        $variables = array(
          'file' => $item,
          'image_style_display' => $settings['imagezoomer_featured_image_style_display'],
          'image_style_zooming' => $settings['imagezoomer_featured_image_style_zooming'],
          'imagezoomer_featured_options' => array(),
        );
        $element[$delta] = array(
          '#markup' => theme('imagezoomer_featured_image', $variables),
        );
      }
      break;
  }
  return $element;
}