Custom Content Form SDK Object
The callback function passed to contentFormSDK.init()
gets
an instance of the SDK object that provides following methods:
Method | Parameter | Required | Returns | Usage |
---|---|---|---|---|
sdk.getLocale() | None | n/a | Returns the current locale of the interface. |
|
sdk.getItem() | None | n/a | Returns the Item object. |
|
sdk.getType() | None | n/a |
Returns Type object of the content item's content type. |
|
sdk.resize(size) | Object with height and width. | no |
Resizes the frame to specified size. When no size is specified, it will resize the iframe to the size of its body. |
|
sdk.registerFormValidation(callback) | Function that handles the validation of the form. | yes |
This callback will be invoked to validate the form when saving. |
|
sdk.previewAsset(options) | options- Object with
id.
|
yes | Opens up asset preview drawer |
|
sdk.getRepositoryDefaultLanguage() | None | n/a | Returns the default language of the current repository. |
|
sdk.createAsset(options) | options- Object with type
|
type -optional; header - optional; callBack - optional, the function is to be invoked when newly created asset is saved. |
When the type is given, it opens up the create item drawer. When the type is not given, it opens up the dialog to choose a type. And after the type is chosen, it opens the create item drawer. When invoking
When invoking
callBack option may be passed if the save option in the header is set
to true and the form invoking |
|
sdk.editAsset(options) | options- Object with id
|
id - required; header - optional; callBack - optional, the function is to be invoked when asset being edited is saved. |
When the given asset is a content item, it opens up edit item drawer. When the given asset is a digital asset, it opens edit attributes drawer. When invoking
When invoking
callBack option may be passed if the save option in the header is set
to true and the form invoking |
|
sdk.getRepositoryId() | None | n/a | Returns Id of the current repository. |
|
sdk.isMediaEditble(options) | options- Object with id
|
id - required | Whether or not the media of the given digital asset is
editable.
|
|
sdk.editMedia(options) | options- Object with id | id - required | Opens edit media drawer. When the digital asset's media is an image, opens image editor drawer. When digital asset's media is an advanced video, opens video editor drawer. |
|
sdk.isAssetEditble(options) | options- Object with id | id - required | Whether or not the asset is editable.
|
|
sdk.getDirection() | None | n/a |
Returns the current direction of the UI. Either |
|
sdk.canCreateAsset(options) | options - object with type | type - required |
Whether or not the asset of a given type can be created.
|
|
SDK Constants
The custom content form SDK has the following field data type constants:
sdk.dataTypes.TEXT
sdk.dataTypes.LARGETEXT
sdk.dataTypes.REFERENCE
sdk.dataTypes.NUMBER
sdk.dataTypes.DECIMAL
sdk.dataTypes.BOOLEAN
sdk.dataTypes.DATETIME
sdk.dataTypes.JSON