Custom Content Form Item Object
sdk.getItem()
returns an Item object which holds item
data.
Method | Parameter | Required | Returns | Usage | |
---|---|---|---|---|---|
item.get() |
None |
n/a |
Basic item
properties.
|
|
|
item.getLanguageOptions() |
None |
n/a |
Method to return a list of language options applicable for creating new item. This method works for a new item only. |
|
|
item.isNew() |
None |
n/a |
Method to specify whether or not the item is new. |
|
|
item.getFields() | Object with height and width. | n/a | Method to return an array of Field objects. |
|
|
item.getFieldById(fieldId) |
field ID string |
yes |
Method to return a Field object by field ID. |
|
|
item.getFieldByName(fieldName) |
field name string |
yes |
Method to return a Field object by field name. |
|
|
item.validateName(name) |
name string |
yes |
Validates a given name and returns a Promise. When
fullfilled returns validation
object.
|
|
|
item.validateDescription(description) |
description string |
yes |
Validates given description and returns a Promise. When
fullfilled returns validation
object.
|
|
|
item.validateSlug(slug) |
slug string |
yes |
Validates given slug and returns a Promise. When
fullfilled returns validation
object.
|
|
|
item.validateLanguage(language) |
language String |
yes |
Validates given language and returns a Promise. When fullfilled returns validation object.
|
|
|
item.setName(name,options) |
name - string options - object with |
name - yes options - optional |
Sets item name. When options with
|
|
|
item.setDescription(description,options) |
description - string options - object with |
description - yes options - optional |
Sets item description. When options with silent: true property is passed, form doesn't become dirty. |
|
|
item.setSlug(slug,options) |
description - string options - object with |
slug - yes options - optional |
Sets slug value. When options with silent: true property is passed, form doesn't become dirty. |
|
|
item.setLanguage(language,options) |
languageCode - string options - object with |
language - yes options - optional |
Sets language. Works for new items only. When options with silent: true property is passed, form doesn't become dirty. |
|
|
item.setTranslatable(isTranslatable,options) |
isTranslatable - boolean options - object with |
setTranslatable - yes options - optional |
Sets whether or not the item is translatable. Will work only if the item is a new master. When options with silent: true property is passed, form doesn't become dirty. |
|
|
item.on(event, handler) |
event - string handler - function that handles the event |
yes |
Currently only 'update' event is supported. |
|
|
item.getChannels() |
None |
n/a |
Returns a Promise. When fullfilled the channels of the item are returned. |
|
|
item.getCollections() |
None |
n/a |
Returns a Promise. When fullfilled the collections of the item are returned. |
|
|
item.getTags() |
None |
n/a |
Returns a Promise. When fullfilled the tags of the item are returned. |
|
|
item.getTaxonomies() |
None |
n/a |
Returns a Promise. When fullfilled the taxonomies of the item are returned. |
|
|
item.getVersionInfo() |
None |
n/a |
Returns a Promise. When fullfilled the version information of the item is returned. |
|
|
item.getPublishInfo() |
None |
n/a |
Returns a Promise. When fullfilled the publish information of the item is returned. |
|
|
item.getPublishedChannels() |
None |
n/a |
Returns a Promise. When fullfilled the published channels of the item are returned. |
|
|
item.addChannels(channels, options) | channels - Array of channel objects
options - Object
with |
channels - yes options - optional |
Adds given channels to the item. |
|
|
item.removeChannels(channels, options) | channels - Array of channel objects
options - Object
with |
channels - yes options - optional |
Removes given channels from the item |
|
|
item.addTags(tags, options) | tags - Array of tag objects
options - Object with
|
tags - yes options - optional |
Adds given tags to the item |
|
|
item.removeTags(tags, options) | tags - Array of tag objects
options - Object with
|
tags - yes options - optional |
Removes given tags from the item |
|
|
item.addCollections(collections, options) | collections - Array of collection objects
options -
Object with |
collections - yes options - optional |
Adds given collections to the item |
|
|
item.removeCollections(collections, options) | collections - Array of collection objects
options -
Object with |
collections - yes options - optional |
Removes given collections from the item |
|
|
item.addCategories(taxonomy, categories, options) | taxonomy - taxonomy under which categories
fall
categories - Array of category objects options -
Object with |
taxonomy -yes
categories - yes options - optional |
Adds given categories under given taxonomy to the item |
|
|
item.removeCategories(taxonomy, categories, options) | taxonomy - taxonomy under which categories
fall
categories - Array of category objects options -
Object with |
taxonomy -yes categories - yes options - optional |
Removes given categories under given taxonomy from the item |
|
|
item.getFormOptions() | None | n/a | Returns form
options{ supportsSetName: true|false, supportsSetDescription: true|false, supportsSetLanguage: true|false, supportsSetTranslatable: true|false, supportsSetSlug: true|false, supportsSetMetaData: true|false, supportsSetNativeFile: true|false, supportsRequiredValidation: true|false, placement: sidebar|drawer, mixedValueFields: [<field_name1>, <field_name2>..] } |
|
|
item.getNativeFileOptions() | None | n/a | Returns native file options. This is an array of possible
options to upload native file. First item in the array allows to upload
the file from computer, followed by options that allow to use the file
from existing
translations.[{ action: "add-from-computer", label: "Add from this computer" value: "add-from-computer" }, { action: "add-from-documents", label: "Add from Documents", value: "add-from-documents" }, { action: "add-from-translation" label: "Use <Language Name> Master" languageIsMaster: true value: <id of master> }, { action: "add-from-translation" label: "Use <Language Name>" languageIsMaster: false value: <id of the translation> }...] |
|
|
item.validateNativeFile() | file - instance of File object | yes | Validates given file object and returns a Promise. When
fullfills returns validation object. Validation is done to validate the
file
type.// when valid { isValid: true, } // when invalid { isValid: false, errorMessageSummary: <error message> errorMessageDetail: <detail error message> }; |
This method should be used to validate the chosen file
when the 'add-from-computer' option is selected to pick a native
file.
|
|
item.setNativeFile(file, options) | file - File objectoptions - Object with {silent:
true|false} |
no | Sets the given file | This method should be used to set the chosen file when
the 'add-from-computer' option is selected to pick a native
file.
|
|
item.setSourceId(sourceId, options) | sourceId - id of the existing translation
options -
Object with |
sourceId - yes options - optional | Sets the given sourceId | This method should be used to set the sourceId when the
'add-from-translation' option is chosen. Selected translation's id
should be passed as
souceId.
|
|
item.openDocumentPicker() | None | n/a | Opens the document picker drawer and returns a Promise.
When fullfills returns an object containing id and name of the selected
document.
|
|
|
item.validateDocument(doc) | doc - document object
|
yes | Validates given document object and returns a Promise.
When fullfills returns validation object. Validation is done to validate
the extension of the document
name.
|
This method typically used to validate the chosen
document when the 'add-from-documents' option is selected and when the
document is chosen from the document
picker.
|
|
item.setDocument(doc, options) | doc - document object
options - Object with
|
yes doc -yes options - optional |
Sets the given document. | This method typically used to set the document when the
given document needs to be used for separate native
file.
|