Source code of native widgets

Hi

Is the code of the native widgets available ?
We’d like to adapt the slug one to be able to check the uniqueness on a custumizable list of content types.

Thanks
Jerome

Hey Jerome!

We open source some of our core UI extensions here: https://github.com/contentful/extensions/tree/master/core-field-editors/src

Unfortunately the slug widget is currently not one of them. I’ll put in a feature request :slight_smile:

Cheers,
Rouven

Hello @Rouven!

I checked out the link to the UI extensions Git you send and it seems that the only code UI extensions that can be found are: Multiline and Single line text editors. I Would love to be able to check out the references Entry link extension would look like and possibly extend that :smile:

Is this something that could be provided?

TYvm!

//Jonathan

How do you want to extend the references extension?

The UI extension SDK as functions which allow you to show the select entry dialog (there’s also select entries, select asset, select assets) that’s pretty easy to use. Something like:

extension.dialogs.selectSingleAsset().then((asset) => {
  if (asset) {
    // do something with asset -- asset.fields.file[extension.field.locale].url
  }
});

Setting references is also pretty easy, like so:

extension.field.setValue(
  {sys: {
    type: 'Link', 
    linkType: 'Entry', 
    id: 'id_of_linked_entry'
  }
})

edit: I see what you want to do now: How to restrict entry to be referenced only once

Thanks for the reply @charlie. I’ve created a UI-Extension that supports my needs now in another way, but i’ll look into what you suggested.