Best approach to wrap rendered file field in a link? I have a file field from the File Entity   module (2.x-alpha2) attached to a content type. I'm trying to customize the output of this field so that it links to the main node (this is for a teaser display). I'm overriding the node template for the teaser display, so I have access to the renderable field array for the field as well as the node path.

I'm trying to find the best approach for wrapping the image in a link. I can easily create the link tag using the l() function. However, I can't just wrap that around the rendered file field because it renders with a lot of extra markup aside from just the image tag.

What is the best approach to handle this? Programmatically altering the theme functions that render the actual image tag? It's not clear to me if I can do that quite yet.

If it helps at all, I'm also using the Media module (2.x-alpha2).
I would create a custom field formatter for rendering the cck field itself. Look for hook_field_formatter_info, hook_field_formatter_view and implement your own custom module

There is also this module https://drupal.org/project/custom_formatters you might want to check out.