It would be swell to be able to have 1 Pixel Out's mp3 plugin work for content type fields that are Links (using the CCK Link module), instead of just for FileField data. This way the plugin could be used with mp3 content that hosted on another site.

I have no experience programming with Drupal, but I do have programming experience, so if someone could give me some general advice on how this could be done, and maybe some links to relevant programming references, there is a chance I could pull it off on my own.

Thanks for your work on this project!

Comments

macho’s picture

Title: Ability to use 1 Pixel Out plugin with Link field as well as FileField » some work done, but i'm stuck

OK, I've done a bit of work on this, but I've gotten stuck, so if anyone has advice it would be appreciated. In the file swftools.module there is a function:

function theme_swftools_formatter_swftools($element)

which accepts the element to be formatted and is supposed to spit out the flash data. i'm editing this to support the link cck field as well as the filefield cck field. the existing formatting is done on a line that looks like this:

$return = swf($element['#item']['filepath']);

i've added something to check if the element in question is a link and format accordingly:

if($is_filefield) {
$return = swf($element['#item']['filepath']);
} else if($is_link) {
$return = swf($element['#node']['display_url']);
}

this seems to work okay, except the element's display url appears to be truncated after about 82 characters (along with an ellipsis), so long urls don't work properly. this may even affect the existing use of filefields with very long filenames. i'm not sure how to determine what the full link is from there. i'll keep working on it, and if someone wants to throw me a bone, feel free.

macho

macho’s picture

Title: some work done, but i'm stuck » correction

above

$return = swf($element['#node']['display_url']);

should be

$return = swf($element['#item']['display_url']);

of course.

macho’s picture

Title: correction » semi-solved

I've got this working on my site, now, with the unfortunate kludge that I hard coded the field name in my content type to get around the issue I mentioned before. If anyone wants to help me find a better solution than that, I'm happy to share my code.

macho’s picture

Title: semi-solved » Add Link module support

i'm just fixing the "issue title" since i clearly didn't realize posting comments could affect it.

macho’s picture

I don't know if this is quite a dupe, but similar in spirit to http://drupal.org/node/465708 so I'll move my discussion there, shortly.

Stuart Greenfield’s picture

Status: Active » Closed (duplicate)

Setting as duplicate of #465708: Add support for CCK Link fields to external files since both describe adding Link field support.