I'm using the core media field with media library to upload files to a node. After uploading, it prompts me to name the file entity. When displaying the node I'd like to be able to display the name as I entered it during the upload process, linked to the file itself (not the file media entity), with an icon describing the file type (PDF/DOCX/etc).

Is there a way to achieve this? I feel like I'm missing something obvious.

Comments

ytsurk’s picture

Core media uses the mime type of files for the thumbnails and adds/generates them, when the media is created. So it will not change ... but need to be removed in the DB, to be regenerated.

For mime type see the file_icon_map function (just to get the idea of how many icons you need to provide ...). Core media does not use this function!

So - put fe. application--vnd.openxmlformats-officedocument.png to sites/default/files/media-icons/generic/ for some word files ... and so on ...

aha - interesting ..