You are here

function flickrfield_field_formatter in Flickr 5

Implementation of hook_field_formatter().

File

field/flickrfield.module, line 153
Defines a Flickr field type.

Code

function flickrfield_field_formatter($field, $item, $formatter, $node) {
  if (empty($item['id'])) {
    return;
  }
  require_once drupal_get_path('module', 'flickr') . '/flickr.inc';
  switch ($item['type']) {
    case 'photo_id':
      $photo_data = flickr_photo_get_info($item['id']);
      $img = flickr_img($photo_data, $formatter);
      $photo_url = flickr_photo_page_url($photo_data['owner'], $photo_data['id']);
      return theme('flickrfield_photo', $img, $photo_url, $formatter, $photo_data, $node);
    case 'set_id':
      $photo_data = flickr_photoset_get_info($item['id']);
      $img = flickr_img($photo_data, $formatter);
      $photo_url = flickr_photo_page_url($photo_data['owner'], $photo_data['id']);
      return theme('flickrfield_photoset', $img, $photo_url, $formatter, $photo_data, $node);
  }
}