Problem/Motivation
With the existing file_download_link formatter a Media field cannot directly be rendered as a download link. One would first have to make a view mode for the Media type that uses the field_download_link to render its file. Then the Media field would render the Media item as a rendered entity using that view mode. It's just a little cumbersome.
Proposed resolution
Add a submodule with a dependency on core media. The module would provide a new field formatter called file_download_link_media. This formatter would be applicable on entity reference fields that exclusively reference media types whose allowed_field_types are file and/or image. The field formatter would essentially render the source field of the referenced media item using the existing file_download_link formatter.
User interface changes
Perhaps a message could be added to the file_download_link formatter form on a media type's manage display form. It could alert the user of this alternative.
API changes
None.
Data model changes
None.
Release notes snippet
TBD
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | file-download-link--media--3108606--4.patch | 28.24 KB | danflanagan8 |
| #2 | file_download_link--media--3108606--2.patch | 27.49 KB | danflanagan8 |
Comments
Comment #2
danflanagan8Here's a patch. Assuming all the tests pass it would be great to get some feedback on this before I merge it in.
Comment #3
danflanagan8Comment #4
danflanagan8Here's an updated patch that includes schema, which was missing from the first patch.
Comment #6
danflanagan8