Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support restricting mimetype in Asset fieldtype with "typefilter" option #1300

Closed
wants to merge 1 commit into from

Conversation

paulthewalton
Copy link

Related to issue #937.
Should be compatible with pull request #1288, but also may overlap some functionality

  • passes "typefilter" option through to cp-assets component
  • validates it as one of the pre-existing typefilters: "image", "video", "audio", "document", "archive", or "code"
  • defaults to empty string (no filter)

Copied from my comment below:

Not sure what the browser compatibility targets are for this project, so I've tried to keep it as wide as possible.

Usage:

In Asset fieldtype options:

{
"typefilter": "image"
}
Setting this option will function the same as picking the typefilter from the dropdown in the UI, but the user will be unable to change the filter. Anything other than one of the predefined typefilter names (case-insensitive) will be discarded, and filtering will work as usual.

- passes "typefilter" option through to cp-assets component
- validates it as one of the pre-existing typefilters: "image", "video", "audio", "document", "archive", or "code"
- defaults to empty string (no filter)
@aheinze aheinze closed this in e281ffe May 16, 2020
@aheinze
Copy link
Member

aheinze commented May 16, 2020

Thanks for the contribution and initializing action to provide a solution for it. Fixed in e281ffe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants