interface EditorInterface {
    controls?: Control[];
    editor?: Editor;
    editorLayout?: FieldGroupItem[];
    editors?: Editor[];
    groupControls?: GroupControl[];
    sidebar?: SidebarItem[];
    sys: MetaSysProps & {
        contentType: {
            sys: MetaLinkProps;
        };
        environment: {
            sys: MetaLinkProps;
        };
        space: {
            sys: MetaLinkProps;
        };
    };
    getControlForField(id: string): null | Control;
    toPlainObject(): EditorInterfaceProps;
    update(): Promise<EditorInterface>;
}

Hierarchy (view full)

Properties

controls?: Control[]

Array of fields and their associated widgetId

editor?: Editor

Legacy singular editor override

editorLayout?: FieldGroupItem[]

Array of editor layout field groups

editors?: Editor[]

Array of editors. Defaults will be used if property is missing.

groupControls?: GroupControl[]

Array of field groups and their associated widgetId

sidebar?: SidebarItem[]

Array of sidebar widgets. Defaults will be used if property is missing.

sys: MetaSysProps & {
    contentType: {
        sys: MetaLinkProps;
    };
    environment: {
        sys: MetaLinkProps;
    };
    space: {
        sys: MetaLinkProps;
    };
}

Methods

  • Gets a control for a specific field

    Parameters

    • id: string

    Returns null | Control

    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

    Returns Promise<EditorInterface>

    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)