Skip to content

Instantly share code, notes, and snippets.

@ctorgalson
Created September 30, 2013 20:37
Show Gist options
  • Save ctorgalson/6769905 to your computer and use it in GitHub Desktop.
Save ctorgalson/6769905 to your computer and use it in GitHub Desktop.
Drupal theme Flickr photoset into Foundation Clearing gallery
<?php
function themename_flickrfield_photoset($variables) {
$img = $variables['0'];
$photo_url = $variables['1'];
$formatter = $variables['2'];
$photo_data = $variables['3'];
$node = $variables['4'];
//
$output = '<ul class="clearing-thumbs flickr-photoset">';
if (module_exists('flickr_sets')) {
$photos = flickr_set_load($photo_data['id']);
foreach ((array) $photos['photoset']['photo'] as $photo) {
// Insert owner into $photo because theme_flickr_photo needs it.
$photo['owner'] = $photos['photoset']['owner'];
$title = is_array($photo['title']) ? $photo['title']['_content'] : $photo['title'];
$img = flickr_img($photo, $formatter, array('data-caption' => $photo['title']));
$original = flickr_photo_img($photo);
$links[] = l($img, $original, array('html' => TRUE));
}
// Theme item list here:
$output = theme('item_list', array('items' => $links, 'attributes' => array(
'class' => array(
'clearing-thumbs',
),
'data-clearing' => 'data-clearing',
)));
}
//
$output .= '</div>';
$output .= '<div class="flickr-photoset-meta">';
$output .= '<p>' . $photo_data['description']['_content'] . '</p>';
$output .= '<cite>' . l(t('Source: Flickr'), $photo_url) . '</cite>';
$output .= '</div>';
return $output;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment