😎 Discover cool tips and tricks for customization in our next Developer Deep Dive virtual event - sign up now!

Export Video Set: 'VideoSet'

1 replies
Last updated: Jul 1, 2022
Hello everybody,I was wondering if someone knows if it is possible to access the fieldset "language' and 'muxVideo' in my custom Input component called 'VideoSet'. When I use the props.type object, I can just see 'title', 'localIdentifier', 'tags' and 'languagespecificVideos'. Is it possible to access the fields of the array?
Thank you very much!

export const videoSet: IObjectType = {
  name: 'muxVideoSet',
  title: 'Mux Video Set',
  type: 'object',
  fields: [
    {
      name: 'language',
      title: 'Language',
      type: 'string',
      validation: (Rule: IRuleType): IRuleType => Rule.required(),
    },
    {
      title: 'Video',
      name: 'muxVideo',
      type: 'muxVideo',
    },
  ],
};

const video: IDocument = {
  name: documentType,
  title: 'Video Set Document',
  type: 'document',
  icon: () => getDocumentIcon('videoSet'),

  fields: [
    {
      title: 'Title',
      name: 'title',
      type: 'string',
    },
    {
      name: 'localeIdentifier',
      title: 'Locale Identifier',
      type: 'reference',
      to: [{ type: 'localeIdentifier' }],
      options: {
        filter: regionMasterPrimaryLanguageFilter,
      },
      validation: (Rule: IRuleType): IRuleType => Rule.required(),
    },
    {
      name: 'tags',
      title: 'Tags',
      description: 'Freetext tag to help find the video.',
      type: 'array',
      options: {
        layout: 'tags',
        editModal: 'popover',
      },
      of: [{ type: 'string' }],
    },
    {
      title: 'Language Specific Videos',
      name: 'languageSpecificVideos',
      type: 'array',
      of: [{ type: 'videoSet' }],
      inputComponent: VideoSet,
    },
  ],

  preview: {
    select: {
      title: 'title',
    },
  },
};

export default video;
Jun 29, 2022, 8:14 AM
user M
forgive me if I'm misunderstanding what you're looking for, but I believe you need the
withDocument
HOC to access that info here.
Jul 1, 2022, 5:11 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?