UiExtension

UiExtension

Source:
UI Extension instances

Type Definitions

UiExtension

Source:
Properties:
Name Type Description
sys Meta.Sys System metadata
extension object UI Extension config
Properties
Name Type Description
name string Extension name
fieldTypes array Field types where an extension can be used
src array URL where the root HTML document of the extension can be found
srcdoc array String representation of the extension (e.g. inline HTML code)
sidebar boolean Controls the location of the extension. If true it will be rendered on the sidebar instead of replacing the field's editing control
toPlainObject() function Returns this UI Extension as a plain JS object

Methods

(static) delete() → {Promise}

Source:
Deletes this object on the server.
Example
const contentful = require('contentful-management')

const client = contentful.createClient({
  accessToken: '<content_management_api_key>'
})

client.getSpace('<space_id>')
.then((space) => space.getUiExtension('<ui_extension_id>'))
.then((uiExtension) => uiExtension.delete())
.then(() => console.log(`UI Extension deleted.`))
.catch(console.error)
Returns:
Promise for the deletion. It contains no data, but the Promise error case should be handled.
Type
Promise

(static) update() → {Promise.<UiExtension>}

Source:
Sends an update to the server with any changes made to the object's properties
Example
const contentful = require('contentful-management')

const client = contentful.createClient({
  accessToken: '<content_management_api_key>'
})

client.getSpace('<space_id>')
.then((space) => space.getUiExtension('<ui_extension_id>'))
.then((uiExtension) => {
  uiExtension.extension.name = 'New UI Extension name'
  return uiExtension.update()
})
.then((uiExtension) => console.log(`UI Extension ${uiExtension.sys.id} updated.`))
.catch(console.error)
Returns:
Object returned from the server with updated changes.
Type
Promise.<UiExtension>