Class PageAPI
Extends
ContentObjectAPI, TagContainerAPI.
Defined in: page.js.
Constructor Attributes | Constructor Name and Description |
---|---|
PageAPI(id, success, error, settings)
|
Field Attributes | Field Name and Description |
---|---|
<static> |
PageAPI.WRITEABLE_PROPS
Writable properties for the page object.
|
<static> |
PageAPI.WRITEABLE_PROPS_CONSTRAINTS
|
Method Attributes | Method Name and Description |
---|---|
<static> |
PageAPI.createTag(construct, success, error)
Creates a tag of a given tagtype in this page.
|
<static> |
PageAPI.preview(success, error)
Renders a preview of the current page.
|
<static> |
PageAPI.publish(success, error)
Trigger publish process for the page.
|
<static> |
PageAPI.removeTag(keyword, success, error)
Deletes the specified tag from this page.
|
<static> |
PageAPI.removeTags(keywords, success, error)
Deletes a set of tags from this page.
|
<static> |
PageAPI.takeOffline(success, error)
Takes the page offline.
|
<static> |
PageAPI.template(success, error)
Get this page's template.
|
<static> |
PageAPI.unlock(success, error)
Unlocks the page when finishing editing
|
Class Detail
PageAPI(id, success, error, settings)
- Parameters:
- {number|string} id
- of the page to be loaded
- {function(ContentObjectAPI))=} success
- Optional success callback that will receive this object as its only argument.
- {function(GCNError):boolean=} error
- Optional custom error handler.
- {object} settings
- additional settings for object creation. These
correspond to options available from the REST-API and will
extend or modify the PageAPI object.
- update: true
- Whether the page should be locked in the backend when loading it. default: true
- template: true
- Whether the template information should be embedded in the page object. default: true
- folder: true
- Whether the folder information should be embedded in the page object. default: true WARNING: do not turn this option off - it will leave the API in a broken state.
- langvars: true
- When the language variants shall be embedded in the page response. default: true
- workflow: false
- When the workflow information shall be embedded in the page response. default: false
- pagevars: true
- When the page variants shall be embedded in the page response. Page variants will contain folder information. default: true
- translationstatus: false
- Will return information on the page's translation status. default: false
Field Detail
PageAPI.WRITEABLE_PROPS
Writable properties for the page object. Currently the following
properties are writeable: cdate, description, fileName, folderId,
name, priority, templateId. WARNING: changing the folderId might not
work as expected.
{Constraints for writeable props} PageAPI.WRITEABLE_PROPS_CONSTRAINTS
Method Detail
{TagAPI} PageAPI.createTag(construct, success, error)
Creates a tag of a given tagtype in this page.
The first parameter should either be the construct keyword or ID,
or an object containing exactly one of the following property sets:
- keyword to create a tag based on the construct with given keyword
- constructId to create a tag based on the construct with given ID
- sourcePageId and sourceTagname to create a tag as copy of the given tag from the page
createTag('link', onSuccess, onError);or
createTag({keyword: 'link', magicValue: 'http://www.gentics.com'}, onSuccess, onError);or
createTag({sourcePageId: 4711, sourceTagname: 'link'}, onSuccess, onError);
- Parameters:
- {string|number|object} construct
- either the keyword of the
construct, or the ID of the construct
or an object with the following
properties
- keyword keyword of the construct
- constructId ID of the construct
- magicValue magic value to be filled into the tag
- sourcePageId source page id
- sourceTagname source tag name
- {function(TagAPI)=} success
- Optional callback that will receive the newly created tag as its only argument.
- {function(GCNError):boolean=} error
- Optional custom error handler.
- Throws:
- INVALID_ARGUMENTS
- Returns:
- {TagAPI} The newly created tag.
PageAPI.preview(success, error)
Renders a preview of the current page.
- Parameters:
- {function(string|PageAPI)} success
- Callback to receive the rendered page preview as the first argument, and this page object as the second.
- {function(GCNError):boolean=} error
- Optional custom error handler.
PageAPI.publish(success, error)
Trigger publish process for the page.
- Parameters:
- {funtion(PageAPI)=} success
- Optional callback to receive this page object as the only argument.
- {function(GCNError):boolean=} error
- Optional custom error handler.
PageAPI.removeTag(keyword, success, error)
Deletes the specified tag from this page.
You should pass a keyword here not an Id.
Note: Due to how the underlying RestAPI layer works,
the success callback will also be called if the specified tag
does not exist.
- Parameters:
- {string} keyword
- The keyword of the tag to be deleted.
- {function(PageAPI)=} success
- Optional callback that receive this object as its only argument.
- {function(GCNError):boolean=} error
- Optional custom error handler.
PageAPI.removeTags(keywords, success, error)
Deletes a set of tags from this page.
- Parameters:
-
{Array.
} keywords - The keywords of the tags to be deleted.
- {function(PageAPI)=} success
- Optional callback that receive this object as its only argument.
- {function(GCNError):boolean=} error
- Optional custom error handler.
PageAPI.takeOffline(success, error)
Takes the page offline.
If instant publishing is enabled, this will take the page offline
immediately. Otherwise it will be taken offline during the next
publish run.
- Parameters:
- {funtion(PageAPI)=} success
- Optional callback to receive this page object as the only argument.
- {function(GCNError):boolean=} error
- Optional custom error handler.
{TemplateAPI} PageAPI.template(success, error)
Get this page's template.
- Parameters:
- {funtion(TemplateAPI)=} success
- Optional callback to receive a TemplateAPI object as the only argument.
- {function(GCNError):boolean=} error
- Optional custom error handler.
- Returns:
- {TemplateAPI} This page's parent template.
PageAPI.unlock(success, error)
Unlocks the page when finishing editing
- Parameters:
- {funtion(PageAPI)=} success
- Optional callback to receive this page object as the only argument.
- {function(GCNError):boolean=} error
- Optional custom error handler.