You are here

function theme_flickrfield_field_formatter in Flickr 6

Same name and namespace in other branches
  1. 7 field/flickrfield.module \theme_flickrfield_field_formatter()

Basic flickrfield formatter.

1 string reference to 'theme_flickrfield_field_formatter'
flickrfield_theme in field/flickrfield.module
Implements hook_theme().

File

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

Code

function theme_flickrfield_field_formatter($element) {
  require_once drupal_get_path('module', 'flickr') . '/flickr.inc';
  $item = $element['#item'];
  if (empty($item['id'])) {
    return;
  }
  $node = $element['#node'];
  $formatter = $element['#formatter'];
  $field_name = $element['#field_name'];
  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_photoset_page_url($photo_data['owner'], $photo_data['id']);
      return theme('flickrfield_photoset', $img, $photo_url, $formatter, $photo_data, $node);
  }
}