You are here

function theme_flickrfield_field_formatter in Flickr 7

Same name and namespace in other branches
  1. 6 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(). @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 313
Defines a Flickr field type.

Code

function theme_flickrfield_field_formatter($element) {
  $item = $element['#item'];
  if (empty($item['id'])) {
    return;
  }
  $node = $element['#node'];
  $formatter = $element['#formatter'];
  switch ($item['type']) {
    case 'photo_id':
      $photo_data = flickr_photos_getinfo($item['id']);
      return theme('flickr_photo', array(
        'format' => NULL,
        'attribs' => NULL,
        'size' => $formatter,
        'photo' => $photo_data,
      ));
    case 'id':
      $photo_data = flickr_photosets_getinfo($item['id']);
      return theme('flickr_photoset', array(
        'owner' => $photo_data['owner'],
        'attribs' => NULL,
        'size' => $formatter,
        'photoset' => $photo_data,
        'per_page' => variable_get('flickr_sets_photos_per_set', 6),
      ));
  }
}