- Source:
Editor Interface instances
Methods
(static) getControlForField() → (nullable) {Object}
- Source:
gets a control for a specific field
Example
const contentful = require('contentful-management')
const client = contentful.createClient({
accessToken: '<content_management_api_key>'
})
client.getSpace('<space_id>')
.then((space) => space.getContentType('<contentType_id>'))
.then((contentType) => contentType.getEditorInterface())
.then((editorInterface) => {
control = editorInterface.getControlForField('<field-id>')
console.log(control)
})
.catch(console.error)
Returns:
control object for specific field.
- Type
- Object
(static) update() → {Promise.<EditorInterface>}
- 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.getContentType('<contentType_id>'))
.then((contentType) => contentType.getEditorInterface())
.then((editorInterface) => {
editorInterface.controls[0] = { "fieldId": "title", "widgetId": "singleLine"}
return editorInterface.update()
})
.catch(console.error)
Returns:
Object returned from the server with updated changes.
- Type
- Promise.<EditorInterface>
Type Definitions
Control
- Source:
Properties:
Name | Type | Description |
---|---|---|
fieldId |
srting | the id of the customized field |
widgetId |
string | customization associated to the field |
EditorInterface
- Source:
Properties:
Name | Type | Description |
---|---|---|
sys |
Meta.Sys | System metadata |
controls |
Array.<EditorInterface.Control> | array of fields and it's associated widgetId |