Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
There is currently no way to control the file extensions to match with the allowed file types in the WYSIWYG browser. Adding a new setting to the form and into the plugin would allow for this control.
Comment | File | Size | Author |
---|---|---|---|
#8 | wysiwyg_file_extension_7x3xBRANCH-2867145-7.patch | 3.08 KB | joseph.olstad |
| |||
#5 | wysiwyg_file_extension-2867145-5.patch | 3.58 KB | Anonymous (not verified) |
|
Comments
Comment #1
Anonymous (not verified) CreditAttribution: Anonymous at Cheeky Monkey Media commentedrsmylski created an issue. See original summary.
Comment #2
Anonymous (not verified) CreditAttribution: Anonymous at Cheeky Monkey Media commentedThis patch adds the variable/setting to the form and to the wysiwyg plugin.
Comment #3
Anonymous (not verified) CreditAttribution: Anonymous at Cheeky Monkey Media commentedRerolled against latest dev
Comment #4
joseph.olstadShould also add variable deletes to the hook uninstall in media_wysiwyg.install or maybe better in media.install
Thanks!
Comment #5
Anonymous (not verified) CreditAttribution: Anonymous at Cheeky Monkey Media commentedGood catch.
I also updated media_wysiwyg_media_browser_params_alter() - adding `file_extensions` as an option there as well. Missed that the first time.
Comment #6
joseph.olstadCool thanks, will jam this into 7.x-3.x
And maybe 7.x-2.x dev
Comment #7
joseph.olstadComment #8
joseph.olstadHere's a patch for the 3.x branch
Comment #9
joseph.olstadThis patch might resolve a recently reported issue:
#2629222: Media wysiwyg not respecting "Allowed types in WYSIWYG" option
Comment #10
Siavash CreditAttribution: Siavash at OHO Interactive for Dartmouth commentedHi Joseph,
I see this approach adds a new field for users to define file extensions in the media browser settings. Correct me if I'm wrong here but I feel like we should be using the mime-type in the file entity types to fetch the extensions rather than asking users to define file extensions again... This approach seems to not integrate well with file entity module.
The approach I proposed in https://www.drupal.org/node/2629222#comment-12287731 is loading extensions based on the file_entity types. So if a the document mimetype is set to include txt, pdf and we select Documents, txt and pdf are included as extensions rather than the user having to re-enter these specifically for the media browser and have inconsistencies with what is defined by the file entity configuration.
What I have is a hook, but could get applied into the module so that media actually does this.
Let me know what you think.
Comment #11
joseph.olstadYes Siavash , integrating with the way file_entity does it sounds good as long as it's not too risky. Seems like we already do this for file_entity so we should be taking advantage of that.
I haven't committed the variable approach so if you can write a patch for the integrated file_entity approach we could review that and decide.
Comment #12
Chris Matthews CreditAttribution: Chris Matthews as a volunteer commentedThe 2 year old patch in #8 does not apply to the latest media 7.x-3.x-dev and needs a reroll.