I would like to be able to use the enclosure element formatter for a field other than Image or File; for example, I have a field that contains the URL to an MP3 file on another server, but I want to use this URL as the enclosure. Thank you for your work on this!

Members fund testing for the Drupal project. Drupal Association Learn more


maciej.zgadzaj’s picture

Status: Active » Postponed (maintainer needs more info)

What type of field exactly are you talking about?

jhenderson’s picture

It's a text field only—it's not taking any file upload, but it's referring a path to a file on another server.

jhenderson’s picture

maciej.zgadzaj’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)

Thought it over, and I am not going to implement this I am afraid. All three attributes of <enclosure> element are required by RSS specification - url, length and type, while simple text field could provide value for url attribute only, as there is no way to store other 2 attributes there as well. Therefore such element (and thus the whole feed) would not be able to validate.

jhenderson’s picture

Understandable, and thank you for your reply. Is there any way I can possibly rewrite the enclosure field manually, or include other fields (for length and type) in the content type to use these tokens in the <enclosure>?

Right now my company has podcasts based on RSS feeds in which I have to manually input new posts every day, as well as inputting information in the website itself. Views RSS is absolutely perfect for me to input the information once only in the content type and have it automatically publish my RSS feeds, except the formatting for this one element. I appreciate your consideration and time into this project.

maciej.zgadzaj’s picture

Status: Closed (won't fix) » Fixed

A quick update on this - as Dan has unintentionally submitted a great idea on how this could be solved, both text and link_field fields could now be used to store <enclosure> URLs (and type and length attributes will be generated automatically). New 7.x-2.x-dev version just pushed to d.o, 6.x to follow.

jhenderson’s picture

Thank you so much! This is an amazing fix, and I really appreciate your help!

mattcasey’s picture

Is there a way to add a video from CCK Embedded Media in the enclosure?

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

pkraft’s picture

I have tried version 7.x-2.x-dev that maciej posted but I cannot get it to work and I am afraid there is a simple setting that I have wrong.

I am trying to use a text field for the enclosure that contains a URL pointing to the externally hosted media. The media is an h.264 video hosted on our CDN.

I have chosen the RSS<enclosure>element formatting and the URL is populating the field in the data base but an tag is not being rendered.

Are there any other settings that I need to look for when using a text field as the enclosure element?

Thanks in advance for any help.

Nevermind. I fixed it and the solution was too embarrassing to share.

HarrisonHill’s picture

Version: 7.x-2.0-rc3 » 6.x-2.x-dev
Status: Closed (fixed) » Active

maciej.zgadzaj said that drupal 6 version will follow but this doesn't work with latest dev version for drupal 6.

Any updates or maybe there is any way to get it working with drupal 6? Is there a way to grab manually entered length and type fields from CCK field and then append them to enclosure?

merauluka’s picture

I made a patch for this. It's probably sloppy because I am new to this, but I added the ability to pull Embedded Media Field audio and video files into the enclosure tag.

I've tested it on my development system. Would someone here give it a try?


merauluka’s picture

Issue summary: View changes


  • maciej.zgadzaj committed 69321d0 on 8.x-2.x
    Issue #1561506 (and #1498288): <enclosure> formatting for other fields,...

maciej.zgadzaj’s picture

Issue summary: View changes
Status: Active » Fixed

Support for text and link fields has been added to 6.x-2.x as well.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.