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

swentel’s picture

Assigned: Unassigned » swentel

Hmm, 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.

swentel’s picture

Status: Active » Closed (duplicate)

Moving 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.