You are here

function theme_flickrfield_formatter_photoset_primaryphoto in Flickr 7

Same name and namespace in other branches
  1. 6 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(). @todo: the theme definitions for our field-formatters should go in flickrfield_field_formatter_view() @ see https://drupal.org/node/728792 (section "Changed! Hook Formatter")

File

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

Code

function theme_flickrfield_formatter_photoset_primaryphoto($element) {
  if (empty($element['#item']['flickrid'])) {
    return;
  }
  $formatter_info = explode('_', $element['#formatter']);
  $set_data = flickr_photosets_getinfo($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($set_data['title']) ? $set_data['title']['_content'] : $set_data['title'];
  $vars = array(
    $img,
    $link,
    $set_url,
    $size,
    $title,
  );
  return theme('flickrfield_photoset_primaryphoto', $vars);
}