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

Possible to pass filter to asset source? #20

Open
hessius opened this issue Feb 2, 2021 · 2 comments
Open

Possible to pass filter to asset source? #20

hessius opened this issue Feb 2, 2021 · 2 comments

Comments

@hessius
Copy link

hessius commented Feb 2, 2021

Hi, thanks for a great plugin, love the automatic tag based filters!

So much so that I was wondering if it is possible to make a custom input or pass a filter to the custom asset source to only show / allow files with a certain tag.
(Ideally it wouldn't accept file uploads either).

If it's not possible atm, consider it a feature request and if so I can go into more detail about the use cases

@Aratramba
Copy link
Owner

That's a great idea! I like it ✨

However for the native image input I don't think that's possible right now. Looking at the source there is no information about the field being passed along to the plugin. There is the document though, and theoretically we could parse the schema and find out any other properties like filters on the fields. However this fails pretty quickly when you have multiple image fields defined in your schema. So that's not a viable option.

I don't think you'd really want to build a custom image component, do you?

I'll see if I can file an issue or a PR with Sanity to ask if it's possible to get any schema info available inside the plugin.

@hessius
Copy link
Author

hessius commented Feb 4, 2021

I agree that a custom image component would be a bad idea unless it could retain everything else around the "native" image component, which is unlikely.

If PR / Feature request to sanity then maybe this should be split into two parts:

  • Option do disable upload and use selection only on image inputs
  • Ability to pass along options from image input into custom asset source

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

No branches or pull requests

2 participants