Closed (fixed)
Project:
RSS field formatters
Version:
7.x-1.2
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
31 Jul 2011 at 02:04 UTC
Updated:
28 Jan 2012 at 08:20 UTC
I couldn't get mp3 enclosures uploaded via Media module to show up in RSS feeds. rss_field_formatters created the enclosure tag, but every file URL was the front page URL. In rss_enclosure_field_formatter_view() I found code that expects each $item in the $items argument to have a 'uri' key, but print_r()-ing each $item showed me there was no 'uri' key there, but a 'file' key whose value was on object with a 'uri' property. Changing to code to use that property fixed it for me. That might be a bad hack but I just wanted to report my experience. Incidentally, I'm using 7.x-1.0-beta5 version of Media. Here's the change that fixed it for me:
[rss_field_formatters]$ git diff rss_enclosure.module
diff --git a/public_html/sites/all/modules/contrib/rss_field_formatters/rss_enclosure.module b/public_html/sites/all/modul
index 8372d44..b85676c 100644
--- a/public_html/sites/all/modules/contrib/rss_field_formatters/rss_enclosure.module
+++ b/public_html/sites/all/modules/contrib/rss_field_formatters/rss_enclosure.module
@@ -36,7 +36,8 @@ function rss_enclosure_field_formatter_view($entity_type, $entity, $field, $inst
// Media field items are objects and do not use display property.
$item = (array) $item;
if (!empty($item['display']) || !isset($item['display'])) {
- $url = file_create_url($item['uri']);
+ $item_uri = (array_key_exists('uri', $item) ? $item['uri'] : $item['file']->uri);
+ $url = file_create_url($item_uri);
$length = $item['filesize'];
$type = $item['filemime'];
if ($field['type'] == 'image' && !empty($display['settings']['image_style'])) {
(END)
Comments
Comment #1
mfbThanks for the bug report, should be fixed on 7.x-1.x branch.