Namespace: ContentType

ContentType

Content Type instances

Type Definitions

ContentType #

Properties:
Name Type Description
sys Meta.Sys System metadata
name string
description string
displayField string Field used as the main display field for Entries
fields Array.<Field> All the fields contained in this Content Type
toPlainObject() function Returns this Content Type as a plain JS object
Source:

ContentTypeCollection #

Properties:
Name Type Description
total number
skip number
limit number
items Array.<ContentType.ContentType>
toPlainObject() function Returns this Content Type collection as a plain JS object
Source:

Methods

(static) delete() → {Promise} #

Deletes this object on the server.
Returns:
Promise for the deletion. It contains no data, but the Promise error case should be handled.
Type:
Promise
Source:
Example
contentType.delete()
.catch(err => console.log(err))

(static) getEditorInterface() → {Promise.<EditorInterface.EditorInterface>} #

Gets the editor interface for the object
Important note: The editor interface only represent a published contentType.
To get the most recent representation of the contentType make sure to publish it first
Returns:
Object returned from the server with the current editor interface.
Type:
Promise.<EditorInterface.EditorInterface>
Source:
Example
contentType.getEditorInterface()
.then(editorInterface => console.log(editorInterface.controls))

(static) isDraft() → {boolean} #

Checks if the contentType is in draft mode. This means it is not published.
Returns:
Type:
boolean
Source:

(static) isPublished() → {boolean} #

Checks if the contentType is published. A published contentType might have unpublished changes (@see {ContentType.isUpdated})
Returns:
Type:
boolean
Source:

(static) isUpdated() → {boolean} #

Checks if the contentType is updated. This means the contentType was previously published but has unpublished changes.
Returns:
Type:
boolean
Source:

(static) publish() → {Promise.<ContentType>} #

Publishes the object
Returns:
Object returned from the server with updated metadata.
Type:
Promise.<ContentType>
Source:
Example
contentType.publish()
.then(contentType => console.log(contentType.sys.publishedVersion))

(static) unpublish() → {Promise.<ContentType>} #

Unpublishes the object
Returns:
Object returned from the server with updated metadata.
Type:
Promise.<ContentType>
Source:
Example
contentType.unpublish()
.then(contentType => console.log(contentType.sys))

(static) update() → {Promise.<ContentType>} #

Sends an update to the server with any changes made to the object's properties
Returns:
Object returned from the server with updated changes.
Type:
Promise.<ContentType>
Source:
Example
contentType.name = 'New name'
contentType.update()
.then(contentType => console.log(contentType.name))