sanity-plugin-media
sanity-plugin-media copied to clipboard
How to configure custom fields?
Hi, in your FAQ it reads "If you want to set values you can query in all instances of that asset (alternate text being a good example), consider setting those in the plugin". I want to add "copyright" as a field that I can query in all instances of the image, how can I add this field?
If that faq-text doesn't mean it's possible have such values though the plugin, can you please give some tips on what else to "consider" (as the faq-text says)? :-)
Thanks!
Having the same issue. I want to add new fields to assets, but can't find any examples nor explanation of how to do it. Is it even possible?
Interested in this feature as well!
@robinpyon Any updates here? We all want to know if there is a way to add custom fields to assets 🙂
This feels very related to this issue i just opened: https://github.com/sanity-io/sanity/issues/5367 Maybe this is the more correct repo to raise the issue in?
A workaround for this: on your image
object definition, add a dummy field of the type you want. I.e.
{
type: 'image',
fields: [
{
name: 'globalCaptionField',
title: 'Caption',
type: 'string',
components: {
input: MyCustomComponent
}
}
]
}
Have MyCustomComponent
handle a change to the input by patching the asset's fields