You are here

function theme_flickrfield_photo in Flickr 5

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

Flickrfield photo themes.

If we are not on the node, make the photo link back to the node, otherwise just display the image. To comply with Flickr terms of service add a link back to the Flickr page.

1 theme call to theme_flickrfield_photo()
flickrfield_field_formatter in field/flickrfield.module
Implementation of hook_field_formatter().

File

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

Code

function theme_flickrfield_photo($img, $photo_url, $formatter, $photo_data, $node) {
  $title = is_array($photo_data['title']) ? $photo_data['title']['_content'] : $photo_data['title'];
  if (arg(0) == 'node' && arg(1) == $node->nid) {
    $output = '<div class="flickr-photo-img">' . $img . '</div>';
  }
  else {
    $output = '<div class="flickr-photo-img">' . l($img, 'node/' . $node->nid, array(
      'title' => $title,
    ), NULL, NULL, TRUE, TRUE) . '</div>';
  }
  $output .= '<div class="flickr-citation"><cite>' . l(t('Source: Flickr'), $photo_url) . '</cite></div>';
  return $output;
}