Closed (duplicate)
Project:
Cooliris (PicLens formerly)
Version:
5.x-1.6
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
24 Aug 2008 at 00:12 UTC
Updated:
7 Sep 2008 at 16:51 UTC
In a recent site using Piclens (great module btw), I wanted to inject more information into the rssmediaitems so that I could display more info in the titles within a Piclens slideshow.
In Piclens module, I added:
function theme_mediarssapi_format_item($item) {
return mediarssapi_format_item($item);
}
and in modules like piclens_image_gallery.module (in piclens_image_gallery_mediarss_items()), I added
while ($row = db_fetch_object($result)) {
$node = node_load($row->nid);
$item = array(
+ 'node' => $node,
'title' => $node->title,
'link' => file_create_url($node->images[$content]),
'thumbnail' => file_create_url($node->images['thumbnail']),
@@ -143,8 +144,9 @@
if (variable_get('piclens_image_gallery_link_to', 'image') == 'node') {
$item['link'] = url('node/'. $node->nid, NULL, NULL, TRUE);
}
- $items .= mediarssapi_format_item($item);
+ $items .= theme('mediarssapi_format_item', $item);
}
return $items;
}
Basically, route each item via a theme call to allow overriding in the local theme templates, and pass the entire node so that other data can be accessed.
Comments
Comment #1
swentel commentedHmm, that's actually a nice idea to pass along the complete $node object and create a theming function of it. Gives more opportunities to change, delete or add properties to the rss item. I'm currently stripping out the complete mediarss functions into a separate contrib module (mediarssapi) and I'll use this feature.
Comment #2
swentel commentedMoving the discussion to http://drupal.org/node/300281 - At this point, a few people including me, theming layer isn't the best and cleanest option.