OptionalcontrolsOptionaleditorLegacy singular editor override
OptionaleditorArray of editor layout field groups
OptionaleditorsArray of editors. Defaults will be used if property is missing.
OptionalgroupArray of field groups and their associated widgetId
OptionalsidebarArray of sidebar widgets. Defaults will be used if property is missing.
Gets a control for a specific field
control object for specific field
const contentful = require('contentful-management')
const client = contentful.createClient({
accessToken: '<content_management_api_key>'
})
client.getSpace('<space_id>')
.then((space) => space.getEnvironment('<environment_id>'))
.then((environment) => environment.getContentType('<contentType_id>'))
.then((contentType) => contentType.getEditorInterface())
.then((editorInterface) => {
control = editorInterface.getControlForField('<field-id>')
console.log(control)
})
.catch(console.error)
Sends an update to the server with any changes made to the object's properties
Object returned from the server with updated changes.
const contentful = require('contentful-management')
const client = contentful.createClient({
accessToken: '<content_management_api_key>'
})
client.getSpace('<space_id>')
.then((space) => space.getEnvironment('<environment_id>'))
.then((environment) => environment.getContentType('<contentType_id>'))
.then((contentType) => contentType.getEditorInterface())
.then((editorInterface) => {
editorInterface.controls[0] = { "fieldId": "title", "widgetId": "singleLine"}
editorInterface.editors = [
{ "widgetId": "custom-widget", "widgetNamespace": "app" }
]
return editorInterface.update()
})
.catch(console.error)
Array of fields and their associated widgetId