Download & Extend

Replace file_inline_types variable with a field formatter setting

Project:Drupal core
Version:8.x-dev
Component:file system
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

Before filefield was merged, this patch #485336: Make Content-Disposition configurable for private downloads was added to allow admins to configure which filetypes were presented inline and which were presented as an attachment. This requires the admin to set the variable with PHP code!

variable_set('filefield_inline_types',array('image\/*', 'text\/*', 'flash$', 'audio\/midi'));

This is still the case in D7 and I find it ridiculous. I have a module which adds a simple box to set the variable, but that's a stupid way to do it. If I get time, I'll write up a patch to present the inline/attachment option as a field formatter.

Comments

#1

of course, that variable is called file_inline_types now.

#2

Another option would be #61528: Private files show open/save prompt for PDFs, etc. while public files automatically open inline which removed the Content Disposition line all together.

#3

Title:UI for setting the file_inline_types variable or better, a per field formatter» Replace file_inline_types variable with a field formatter setting

Adding this as a field formatter sounds reasonable. I resisted adding any such option to FileField itself, considering for most sites this is an esoteric option. I still think it's rather edge-casey but at least by making it a formatter setting it's placing the option in the right location. Of course we shouldn't show this option at all unless you're using private files, since public files Content-disposition headers are set by the web server.

nobody click here