By default, the "Add File" widget only allows you to upload .pdf or .txt files. So, this is something that lots of users will potentially want to change! However, changing it will cause panopoly_widgets Feature to become Overridden.
To make this super common change easier for users, I think we should:
- Put a field on the panopoly_widgets admin page for the list of file extensions
- Implement a
hook_*_defaults_alter()(can't remember the exact hook name right now) that puts the value from that variable into the Field settings
That way users can easily change which extensions can be used, and the Feature won't be marked as Overridden!
(BTW, in Austin this is something @populist and @dsnopek discussed doing more of in Panopoly to make customizations easier and not necessarily require Features Override).
Original report
In file settings: admin/config/media/file-settings I have these extensions allowed for upload:
jpg jpeg gif png txt doc docx xls xlsx pdf ppt pptx pps ppsx odt ods odp mp3 mov mp4 m4a m4v mpeg avi ogg oga ogv wmv ico
I tried to upload a doc file in "Create a new custom entity" pane and got this message:
"Only files with the following extensions are allowed: pdf, txt."
Where do I set the allowed file types for this and why it's not replicating the general file settings?
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | panopoly_test-file-allowed-extensions-2276089-13.patch | 662 bytes | dsnopek |
| #9 | panopoly_widgets-file-allowed-extensions-2276089-1.patch | 4.1 KB | dsnopek |
| #4 | Screenshot of Safari (24-07-2014 10:41:08).png | 42.32 KB | maustyle |
Comments
Comment #1
maustyle commentedComment #2
maustyle commentedComment #3
mglamanMaustyle,
I haven't seen this "Create a new custom entity" pane before and it's not out-of-the-box Panopoly. What module provides that pane? Also, the issue is probably for that project. If you provide the name of the module (or if not sure, some of the modules you've added) I'll help debug and we can fix here or move to that project's queue.
Comment #4
maustyle commentedIt shows up when you go to Panelizer first and add some content. then, when the admin layer pops up, click on 'Add file'.
then the 'Configure new Add file' layer appears, then see the screenshot. it only allows pdf and txt, but in my general settings
admin/config/media/file-settings
i have allowed more formats.
thanks for your help.
Comment #5
dsnopekOk! This would then be the field settings for the field on the "Add File" fieldable panels pane. You can change what types are available at this path on your Panopoly site (as an admin):
/admin/structure/fieldable-panels-panes/manage/basic-file/fields/field_basic_file_file@maustyle: This should allow you to do what you want!
However, changing this will cause the panopoly_widgets Feature to become Overridden. I think this is a case where we should make it easier for users to change without the Feature becoming overridden (the trick is basically doing a
hook_*_default_alter()in panopoly_widgets itself where we use the value of a variable). I've updated the issue summary to reflect what I'm thinking.Comment #6
dsnopekComment #7
dsnopekComment #8
cboyden commentedI would also like to have the initial settings for the File widget include all of the non-image file types that are allowed by the Media Browser in WYSIWYG fields. Better not to update anything for existing sites; this would only be for new installations.
Comment #9
dsnopekAlright! Here is a patch that adds a setting on the Panopoly Widgets configuration page to set the list of allowed extensions without overriding the Feature. I also changed the default list of allowed extensions to match the allowed extensions for updating a Document file entity per @cboyden's suggestion - it really doesn't make sense to have two seperate defaults for the same use case: uploading a document.
Comment #10
dsnopekCommitted!
Comment #12
dsnopekBlergh! This breaks the automated tests:
https://travis-ci.org/panopoly/panopoly/jobs/47851286#L924
Basically, we just need to update the tests to check for the new list of default file types!
Comment #13
dsnopekHere is a patch to panopoly_test to fix the tests. We'll see what Travis-CI says!
https://travis-ci.org/dsnopek/panopoly/builds/47866277
Comment #14
dsnopekPassed on Travis-CI, commiting!
Comment #16
cboyden commentedPart of the reason for this change is to allow sites or distros to change the allowed list without overriding the feature, so I think it might not be the right thing to hard-code the default list into the test. Does the feature need to check for allowed file types, and if so, is there a way to do it that's more flexible?
Comment #17
cboyden commentedGah! I commented about the test thing on a stale browser window, so I didn't see @dsnopek's latest update. Somehow that also deleted the patch and reset the status?
Comment #18
dsnopekRestored status and file attachment. :-)