Adds an option to link file to entity

Out of the box, the Media and File Entity modules attach media to entities using Fields but they provide no way to then display media in those fields as links to the parent entity. A common use-case for this would be a teaser view of a node showing an image linked to the node.

This very simple module adds an option to the "File Types" view mode settings to accomplish this (at admin/config/media/file-types/manage/image/file-display for images).

A few notes:

  • This module has been tested with the fields of type "file" and "image". It will not work with fields of type "multimedia asset".
  • Links are placed around only the file portion of the file entity. If you've added fields (like caption, etc) to your entity they will not be linked. This was preferable for my application and informed the architecture of this module.
  • Any type of file can be linked, you're not limited to just applying links to images. Of course, it's possible some file types will output markup that will not acquit itself well to being wrapped in a link

Sponsored by Forum One Communications

Project Information

Downloads