function _optotrip_block_flickr() {
$termtext = _optotrip_get_block_context();
if ($termtext == '') {
return NULL;
}
lightbox2_add_files();
// perform search
'text' => $termtext,
'per_page' => 16,
'sort' => 'interestingness-desc', // 'relevance',
);
// if results found, emit block content
if ($photos = flickr_photos_search('', 1, $args)) {
$content = '<div class="myflickr">';
foreach ($photos['photo'] as $photo) {
$content .=
theme('flickr_photo',
$photo,
's',
array('rel' =>
'lightbox[flickr]') );
// print theme('flickr_photo_box', $photo, 's');
}
$content .= '</div>';
// HACK: add some padding to the flickr images
drupal_set_html_head('<style type="text/css" media="all">div.myflickr img { padding: 5px; }</style>');
}
else {
$content =
t('No photos found');
}
// dsm("_optotrip_block_flickr($termtext) ===> ". (microtime(TRUE) - $starttime));
// return the block information
'subject' =>
t('Flickr for: @name',
array('@name' =>
$termtext)),
'content' => $content,
);
}