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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Anonymous’s picture

rsmylski created an issue. See original summary.

Anonymous’s picture

Status: Active » Needs review
FileSize
2.32 KB

This patch adds the variable/setting to the form and to the wysiwyg plugin.

Anonymous’s picture

Rerolled against latest dev

joseph.olstad’s picture

Should also add variable deletes to the hook uninstall in media_wysiwyg.install or maybe better in media.install

Thanks!

Anonymous’s picture

Good catch.

I also updated media_wysiwyg_media_browser_params_alter() - adding `file_extensions` as an option there as well. Missed that the first time.

joseph.olstad’s picture

Cool thanks, will jam this into 7.x-3.x
And maybe 7.x-2.x dev

joseph.olstad’s picture

Assigned: Unassigned » joseph.olstad
joseph.olstad’s picture

Version: 7.x-2.x-dev » 7.x-3.x-dev
FileSize
3.08 KB

Here's a patch for the 3.x branch

joseph.olstad’s picture

Siavash’s picture

Hi 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.

joseph.olstad’s picture

Yes 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.

Chris Matthews’s picture

Assigned: joseph.olstad » Unassigned
Status: Needs review » Needs work
Issue tags: +Needs reroll

The 2 year old patch in #8 does not apply to the latest media 7.x-3.x-dev and needs a reroll.