You are here

function photobox_field_formatter_view in PhotoboxPhotobox 7

Implements hook_field_formatter_view().

File

./photobox.module, line 240
Main file for the Photobox module.

Code

function photobox_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
  $element = array();
  foreach ($items as $delta => $item) {
    $element[$delta] = array(
      '#theme' => 'photobox_image_formatter',
      '#item' => $item,
      '#entity_type' => $entity_type,
      '#entity' => $entity,
      '#field' => $field,
      '#display_settings' => $display['settings'],
      '#delta' => $delta,
    );

    // We need to add it to every delta for the File entity display to work correctly.
    $element[$delta]['#attached'] = photobox_attached_resources();
  }
  return $element;
}