You are here

function linkimagefield_field_formatter_view in Link Image Field 7

Implements hook_field_formatter_view().

File

./linkimagefield.module, line 327
Defines a link image field type.

Code

function linkimagefield_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
  $element = array();
  foreach ($items as $delta => $item) {

    // Set default values for empty elements.
    _linkimagefield_format_set_attribute('url', $item, $instance);
    _linkimagefield_format_set_attribute('alt', $item, $instance);
    _linkimagefield_format_set_attribute('title', $item, $instance);
    _linkimagefield_format_set_attribute('target', $item, $instance);
    $element[$delta] = array(
      '#theme' => 'linkimage_formatter',
      '#item' => $item,
      '#image_style' => $display['settings']['image_style'],
    );
  }
  return $element;
}