UI-extension for type "link" not showing up

Hello,

I’m trying to add a UI-extension for a reference field, but unfortunately it’s not showing up in my content model.

Here’s what I do:

const cli = require( 'contentful-extension-cli' );
const { readFileSync } = require( 'fs' );
const { config } = require( './package.json' );

async function init() {
  try {
    const client = cli.createClient ( {
      spaceId     : 'xxx',
      accessToken : 'xxx'
    } );

    const savedExtension = await client.save( {
      id: 'cf-contentful-ui-ref-radio-select',
      name: 'Contentful UI reference radio select',
      fieldTypes: [ 'Link' ],
      srcdoc: readFileSync( './index.html', { encoding: 'utf8' } ),
      version: 5
    } );
  } catch( error ) {
    console.error( error );
    process.exit( 1 );
  }
}

init();

I get the following response which means that the call was successful.

{ extension: 
  { srcdoc: '<!doctype html>\n<html lang="en">\n  <head>\n    <meta charset="UTF-8"/>\n    <title>Contentful UI extension country select</title>\n    <link rel="stylesheet" href="https://contentful.github.io/ui-extensions-sdk/cf-extension.css">\n    <script src="https://contentful.github.io/ui-extensions-sdk/cf-extension-api.js"></script>\n  </head>\n  <body>\n    yeah!!!\n  </body>\n</html>',
    name: 'Contentful UI reference radio select',
    fieldTypes: [ [Object] ] },
  sys: 
  { id: 'cf-contentful-ui-ref-radio-select',
    type: 'Extension',
    version: 6,
    createdAt: '2017-07-21T10:51:40.797Z',
    createdBy: { sys: [Object] },
    space: { sys: [Object] },
    updatedAt: '2017-07-21T11:03:48.558Z',
    updatedBy: { sys: [Object] } } }
{ sys: { type: 'Array' },
  total: 1,
  skip: 0,
  limit: 0,
  items: [ { extension: [Object], sys: [Object] } ] }

But then looking in the content model panel I can not choose the new extension. Am I missing something?

Please refer https://github.com/contentful/contentful-extension-cli#extension-properties

Valid values for singular references are: Entry, Asset

1 Like

Oh well… :slight_smile: Thanks!!! :ok_hand:

Changing fieldTypes to

[
  "Entry"
]

Resolves the issue.

1 Like