You are here

function iss_field_formatter_view in Image Style Selector 7

Implements hook_field_formatter_view().

File

./iss.module, line 211
Image Style Selector field.

Code

function iss_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
  $element = array();
  if ($display['type'] == 'iss_formatter') {
    foreach ($items as $delta => $item) {
      $images = field_get_items($entity_type, $entity, $instance['settings']['image_field_name'], $langcode);
      if (!empty($images)) {
        foreach ($images as $image_delta => $image) {
          $element[$delta][$image_delta] = array(
            '#theme' => 'image_formatter',
            '#item' => $image,
            '#image_style' => $item['image_style'],
          );
        }
      }
    }
  }
  return $element;
}