function theme_flickrfield_formatter_photoset_primaryphoto in Flickr 6
Same name and namespace in other branches
- 7 field/flickrfield.module \theme_flickrfield_formatter_photoset_primaryphoto()
Theme a Flickr photo set as the primary photo of that set.
1 string reference to 'theme_flickrfield_formatter_photoset_primaryphoto'
- flickrfield_theme in field/
flickrfield.module - Implements hook_theme().
File
- field/
flickrfield.module, line 364 - Defines a Flickr field type.
Code
function theme_flickrfield_formatter_photoset_primaryphoto($element) {
require_once drupal_get_path('module', 'flickr') . '/flickr.inc';
if (empty($element['#item']['flickrid'])) {
return;
}
$formatter_info = explode('_', $element['#formatter']);
$set_data = flickr_photoset_get_info($element['#item']['flickrid']);
$set_url = flickr_photoset_page_url($set_data['owner'], $set_data['id']);
$size = substr($formatter_info[2], -1);
$img = flickr_img($set_data, $size);
switch ($formatter_info[3]) {
case 'linknode':
$link = 'node/' . $element['#node']->nid;
break;
case 'linkflickrcomset':
$link = $set_url;
break;
default:
$link = NULL;
break;
}
$title = is_array($photo_data['title']) ? $photo_data['title']['_content'] : $photo_data['title'];
return theme('flickrfield_photoset_primaryphoto', $img, $link, $set_url, $size, $title);
}