You are here

function theme_flickr_photoset in Flickr 7

Same name and namespace in other branches
  1. 5 flickr.module \theme_flickr_photoset()
  2. 6 flickr.module \theme_flickr_photoset()

Theme Flickr photoset.

2 theme calls to theme_flickr_photoset()
flickr_block_photosets in block/flickr_block.module
Photoset block. Block delta: 1 and 4.
theme_flickrfield_field_formatter in field/flickrfield.module
Basic flickrfield formatter.

File

./flickr.module, line 864
The Flickr module.

Code

function theme_flickr_photoset($variables) {
  $photoset = $variables['photoset'];
  $owner = $variables['owner'];
  $size = $variables['size'];
  $media = isset($variables['media']) ? $variables['media'] : 'photos';
  $attribs = $variables['attribs'];
  $min_title = $variables['min_title'];
  $min_metadata = $variables['min_metadata'];
  $per_page = isset($variables['per_page']) ? $variables['per_page'] : variable_get('flickr_photos_per_page', 6);
  if (module_exists('flickr_sets')) {
    $output = "<div class='flickr-photoset'>\n";
    $photos = flickr_photosets_getphotos($photoset['id'], array(
      'per_page' => $per_page,
      'media' => $media,
    ));
    if ($photos['photoset']['total']) {
      foreach ((array) $photos['photoset']['photo'] as $photo) {

        // Insert owner into $photo because theme_flickr_photo needs it.
        $photo['owner'] = $owner;
        $output .= theme('flickr_photo', array(
          'photo' => $photo,
          'size' => $size,
          'format' => NULL,
          'attribs' => $attribs,
          'min_title' => $variables['min_title'],
          'min_metadata' => $variables['min_metadata'],
          'per_page' => $per_page,
        ));
      }
    }
    else {
      $output .= t('No media in this set.');
    }
    $output .= '</div>';
    return $output;
  }
  else {
    $img = flickr_img($photoset, $size, $attribs);
    $output = theme('pager');
    $photo_url = flickr_photoset_page_url($owner, $photoset['id']);
    $output .= "<div class='flickr-photoset'>\n";
    $title = is_array($photoset['title']) ? $photoset['title']['_content'] : $photoset['title'];
    return l($img, $photo_url, array(
      'attributes' => array(
        'title' => $title,
      ),
      'absolute' => TRUE,
      'html' => TRUE,
    ));
  }
}