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

Comments

danflanagan8 created an issue. See original summary.

danflanagan8’s picture

StatusFileSize
new27.49 KB

Here's a patch. Assuming all the tests pass it would be great to get some feedback on this before I merge it in.

danflanagan8’s picture

Assigned: danflanagan8 » Unassigned
Status: Active » Needs review
danflanagan8’s picture

StatusFileSize
new28.24 KB

Here's an updated patch that includes schema, which was missing from the first patch.

  • danflanagan8 committed f9037f0 on 8.x-1.x
    Issue #3108606 by danflanagan8: Support rendering Media reference field...
danflanagan8’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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