Skip to content

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

Closed
paulthewalton wants to merge 1 commit into
agentejo:nextfrom
paulthewalton:next
Closed

Support restricting mimetype in Asset fieldtype with "typefilter" option#1300
paulthewalton wants to merge 1 commit into
agentejo:nextfrom
paulthewalton:next

Conversation

@paulthewalton

Copy link
Copy Markdown

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

aheinze commented May 16, 2020

Copy link
Copy Markdown
Member

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