QuickNav
Methods
- activateComponent(slotId, componentId, event)
- addComponent(args) → {String}
- addComponentToPageModel(args)
- getAudienceAttribute(name) → {String|Array|undefined}
- getAudienceAttributes() → {Object}
- getAudienceAttributesReady() → {Boolean}
- getCacheKey(keyName) → {String}
- getCDNPrefix() → {String}
- getComponentCatalogUrlPrefix() → {String}
- getComponentInstanceData(componentId) → {Object|undefined}
- getContentClient() → {Object}
- getContentUrl(fileName) → {String}
- getContentUrlPrefix() → {String}
- getContentValue()
- getCustomPageProperty(propertyName, pageIdopt) → {String|undefined}
- getCustomSiteProperty(propertyName) → {String|undefined}
- getDefaultPageProperty(propertyName) → {String|undefined}
- getDeviceInfo() → {Object}
- getDistDirUrlPrefix(allowCDN) → {String}
- getJQuery() → {Object}
- getLanguageCode() → {String}
- getMarked() → {Object}
- getMustache() → {Object}
- getPageId() → {Number}
- getPageInformation() → {Object}
- getPageLanguageCode() → {String}
- getPageLinkData(pageId, optionsopt) → {Object}
- getPageLinkInfo(pageId, optionsopt) → {Object}
- getPageLinkUrl()
- getPageLocaleAlias() → {String|undefined}
- getPageMetadata(property) → {String|undefined}
- getPlaceholderContent() → {Object|undefined}
- getRenderMetrics() → {undefined}
- getRenderMode() → {String}
- getSiteId() → {String}
- getSitePathPrefix() → {String}
- getSiteProperty(propertyName) → {String|undefined}
- getThemeDesignUrlPrefix() → {String}
- getThemeUrlPrefix() → {String}
- moveComponent(fromSlotId, fromComponentGroupIdopt, componentId, toSlotId, toComponentGroupIdopt, positionopt, columnNodeopt)
- onCapabilityChange(componentId)
- onComponentRenderComplete(componentId)
- recordAssetOperation(assetId, operation) → {Boolean}
- removeComponent(slotId, containerId, componentId)
- removeComponentFromPageModel(componentId)
- renderComponent(componentId, slotId, optionsopt)
- setAudienceAttribute() → {Boolean}
- setAudienceAttributesReady(ready)
- setComponentDraggable()
- setComponentInstanceData(componentId, dataopt, skipUndoEntryopt)
- setPageMetadata(property, valueopt)
- showLinkDeactivatedMessage()
window.SCSRenderAPI
The SCSRenderAPI singleton.
Methods
activateComponent(slotId, componentId, event)
Deactivates the currently active component (if there is one) and activates the specified component. Activating a component causes it to render in its editing state.
Parameters:
Name | Type | Description |
---|---|---|
slotId |
String | The slot ID. |
componentId |
String | The component ID. |
event |
Object | (not used) |
addComponent(args) → {String}
Adds a component to a slot and optionally within a component group.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
args |
Object | An object containing the following values:
Properties
|
Fires:
- COMPONENT_ADDED_EVENT ("scscomponentadded")
Returns:
The ID of the newly added component.
- Type
- String
addComponentToPageModel(args)
Adds a component to the page model.
Parameters:
Name | Type | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
args |
Object | An object containing the following values:
Properties
|
Returns:
The ID of the newly added component.
getAudienceAttribute(name) → {String|Array|undefined}
Gets the stored audience attribute value given a name.
In design time, audience attributes initial values are populated via the “Profile” chosen in the Site Builder user interface. Unlike in runtime, the items cannot also be set via setAudienceAttribute in design time, since that function only maintains symmetry with the runtime.
In design time, audience attributes initial values are populated via the “Profile” chosen in the Site Builder user interface. Unlike in runtime, the items cannot also be set via setAudienceAttribute in design time, since that function only maintains symmetry with the runtime.
Parameters:
Name | Type | Description |
---|---|---|
name |
String | The audience attribute name. |
Returns:
The stored audience attribute value(s) or undefined.
- Type
- String | Array | undefined
getAudienceAttributes() → {Object}
Gets the stored audience attribute values.
In design time, audience attributes initial values are populated via the “Profile” chosen in the Site Builder user interface. Unlike in runtime, the items cannot also be set via setAudienceAttribute in design time, since that function only maintains symmetry with the runtime.
In design time, audience attributes initial values are populated via the “Profile” chosen in the Site Builder user interface. Unlike in runtime, the items cannot also be set via setAudienceAttribute in design time, since that function only maintains symmetry with the runtime.
Returns:
The stored audience attribute values as an Object. This object may have no properties.
- Type
- Object
getAudienceAttributesReady() → {Boolean}
Gets the audience attributes ready flag. Components that depend upon audience attributes being available should delay rendering until this flag is set to true.
The returned ready flag is initially set to true when the page is loaded. This flag can also be controlled with the setAudienceAttributeReady function.
The returned ready flag is initially set to true when the page is loaded. This flag can also be controlled with the setAudienceAttributeReady function.
Returns:
The audience attributes ready flag.
- Type
- Boolean
getCacheKey(keyName) → {String}
Gets the cache key for the given section.
Although you can query for the same 5 keys, only “product”, “theme”, and “component” will have values. (The other two sections “site” and “caas” are never cached in design time.)
Although you can query for the same 5 keys, only “product”, “theme”, and “component” will have values. (The other two sections “site” and “caas” are never cached in design time.)
Parameters:
Name | Type | Description |
---|---|---|
keyName |
String | The possible values for the keyName are: 'product' | 'site' | 'component' | 'theme' | 'caas'. |
Returns:
The cache key for the given section.
- Type
- String
getCDNPrefix() → {String}
Gets the sitesCloudCDN value, if present.
Returns:
The sitesCloudCDN value, if present.
- Type
- String
getComponentCatalogUrlPrefix() → {String}
Gets the URL prefix for the catalog of components.
Returns:
The URL prefix for the catalog of components.
- Type
- String
getComponentInstanceData(componentId) → {Object|undefined}
Gets the component's internal data.
Parameters:
Name | Type | Description |
---|---|---|
componentId |
String | The component ID. |
Returns:
Returns the component's internal data object or undefined.
- Type
- Object | undefined
getContentClient() → {Object}
Returns a ContentClient instance, which can be used to obtain information from CaaS.
Returns:
A ContentClient object
- Type
- Object
getContentUrl(fileName) → {String}
Uses getContentUrlPrefix to calculate the appropriate URL with the supplied file name.
Parameters:
Name | Type | Description |
---|---|---|
fileName |
String | The file name to append to the content URL prefix. |
Returns:
The calculated content URL.
- Type
- String
getContentUrlPrefix() → {String}
Computes and gets the content URL prefix by using SCS_GET_CONTENT url with siteId, variantId and filename.
Returns:
The content URL prefix.
- Type
- String
getContentValue()
Deprecated.
getCustomPageProperty(propertyName, pageIdopt) → {String|undefined}
Gets a page property value given a page ID and property name.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
propertyName |
String | Property name. | |
pageId |
String |
<optional> |
The page ID. |
Returns:
The property value.
- Type
- String | undefined
getCustomSiteProperty(propertyName) → {String|undefined}
Gets a custom site property value given a property name.
Parameters:
Name | Type | Description |
---|---|---|
propertyName |
String | Property name. |
Returns:
The property value.
- Type
- String | undefined
getDefaultPageProperty(propertyName) → {String|undefined}
Gets a default page property value given a property name.
Parameters:
Name | Type | Description |
---|---|---|
propertyName |
String | Property name. |
Returns:
The property value.
- Type
- String | undefined
getDeviceInfo() → {Object}
Gets info about current device.
Customizations to the controller code will not take effect in design time, only runtime.
Customizations to the controller code will not take effect in design time, only runtime.
Returns:
An object with device info.
Default return object: { isMobile: [true | false], isIOS: [true | false] }
Default return object: { isMobile: [true | false], isIOS: [true | false] }
- Type
- Object
getDistDirUrlPrefix(allowCDN) → {String}
Gets the distribution directory prefix.
Parameters:
Name | Type | Description |
---|---|---|
allowCDN |
Boolean | Switch that adds a CDN prefix when applicable. |
Returns:
The distribution directory prefix.
- Type
- String
getJQuery() → {Object}
Gets the renderer's JQuery object
Returns:
The JQuery object reference.
- Type
- Object
getLanguageCode() → {String}
Gets the language code.
Returns:
The language code.
- Type
- String
getMarked() → {Object}
Gets the renderer's marked object, used for Markdown parsing
Returns:
The marked object reference.
- Type
- Object
getMustache() → {Object}
Gets the renderer's Mustache object
Returns:
The Mustache object reference.
- Type
- Object
getPageId() → {Number}
Gets the ID of the current page.
Returns:
The ID of the current page.
- Type
- Number
getPageInformation() → {Object}
Get the information about whether the page is a regular dynamic page or if it’s a compiled static page.
Returns:
An object with the state. Design time is always 'dynamic'. Runtime is either 'dynamic' or 'compiled'.
- Type
- Object
getPageLanguageCode() → {String}
Gets the language code for the current page.
Returns:
The language code for the current page.
- Type
- String
getPageLinkData(pageId, optionsopt) → {Object}
Gets the link data for a given page.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
pageId |
String | The target page ID. | |||||||||||||||||||||
options |
Object |
<optional> |
The options object.
Properties
|
Returns:
The link data, including href, target, and hideInNavigation properties.
- Type
- Object
getPageLinkInfo(pageId, optionsopt) → {Object}
Gets the link data for a given page. While similar to getPageLinkData, this method takes
optional queryParams and fragment parameters.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
pageId |
String | The target page ID. | |||||||||||||||||||||||||||||||||
options |
Object |
<optional> |
The options object.
Properties
|
Returns:
The link data, including href, target, and hideInNavigation properties.
- Type
- Object
getPageLinkUrl()
Deprecated. Use getPageLinkData(...) instead.
getPageLocaleAlias() → {String|undefined}
Returns the language code alias for the current page.
Returns:
The language code alias for the current page, or undefined.
- Type
- String | undefined
getPageMetadata(property) → {String|undefined}
Gets the value of the requested page property.
Parameters:
Name | Type | Description |
---|---|---|
property |
String | The property key. |
Returns:
The property value.
- Type
- String | undefined
getPlaceholderContent() → {Object|undefined}
Gets the details about the content in a detail page.
Returns:
An object containing contentType, contentId, contentSlug. Returns undefined for a non-detail page.
- Type
- Object | undefined
getRenderMetrics() → {undefined}
This function has no effect in the design time environment.
Returns:
- Type
- undefined
getRenderMode() → {String}
Gets the current rendering mode.
Returns:
The current rendering mode.
- Type
- String
Example
window.SCSRenderAPI.getRenderMode();
// => 'edit'
// Possible return values: SCSRenderAPI.RENDER_MODE_EDIT | SCSRenderAPI.RENDER_MODE_NAVIGATE | SCSRenderAPI.RENDER_MODE_ANNOTATION
getSiteId() → {String}
Gets the site ID.
Returns:
The site ID.
- Type
- String
getSitePathPrefix() → {String}
Computes and gets the site path prefix including a cache key unless we are in RENDER_MODE_PREVIEW in which case there is no cache key. Trailing slashes will be removed.
Returns:
The site path prefix without a trailing slash.
- Type
- String
getSiteProperty(propertyName) → {String|undefined}
Gets a site property value given a property name.
Parameters:
Name | Type | Description |
---|---|---|
propertyName |
String | Property name. |
Returns:
The property value.
- Type
- String | undefined
getThemeDesignUrlPrefix() → {String}
Gets the theme's design URL prefix.
Returns:
The theme's design URL prefix.
- Type
- String
getThemeUrlPrefix() → {String}
Gets the theme URL prefix.
Returns:
The theme URL prefix.
- Type
- String
moveComponent(fromSlotId, fromComponentGroupIdopt, componentId, toSlotId, toComponentGroupIdopt, positionopt, columnNodeopt)
Moves a component to a new location.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
fromSlotId |
String | The ID of the slot to move from. | |
fromComponentGroupId |
String |
<optional> |
The ID of the component group to move from (if there is one). |
componentId |
String | The ID of the component to move. | |
toSlotId |
String | The ID of the slot to move to. | |
toComponentGroupId |
String |
<optional> |
The ID of the component group to move to (if there is one). |
position |
String |
<optional> |
The position in the slot to add the new component at. |
columnNode |
String |
<optional> |
The column within which to insert a given component. |
Fires:
- COMPONENT_MOVED_EVENT ("scscomponentmoved")
onCapabilityChange(componentId)
This is called under two circumstances by components:
1. When the component is initially rendered and its internal viewModel becomes available. (After this point, getCapabilities will work.)
2. When the component changes materially -- something that would suggest a change to its title or context menus.
1. When the component is initially rendered and its internal viewModel becomes available. (After this point, getCapabilities will work.)
2. When the component changes materially -- something that would suggest a change to its title or context menus.
Parameters:
Name | Type | Description |
---|---|---|
componentId |
String |
onComponentRenderComplete(componentId)
Components should call this function when they complete rendering – in order to allow operations that happen following the page rendering to complete in a timely fashion.
Parameters:
Name | Type | Description |
---|---|---|
componentId |
String | The ID of the component that finished rendering. |
recordAssetOperation(assetId, operation) → {Boolean}
Records an asset operation in the analytics system.
Components should call this function when they need to indicate that an asset operation has happened. In the Management environment this call simply returns without performing any actions. This maintains API parity with the Runtime API.
Components should call this function when they need to indicate that an asset operation has happened. In the Management environment this call simply returns without performing any actions. This maintains API parity with the Runtime API.
Parameters:
Name | Type | Description |
---|---|---|
assetId |
String | The ID of the asset, a Content Item or Digital Asset. |
operation |
String | The operation that occurred for the asset. Operation values include: load , view , download , and play . |
Returns:
A Boolean value indicating if the operation was accepted for processing.
- Type
- Boolean
removeComponent(slotId, containerId, componentId)
Removes the component from the DOM and the page model.
Parameters:
Name | Type | Description |
---|---|---|
slotId |
String | The slot ID. |
containerId |
String | The container ID. |
componentId |
String | The component ID. |
Fires:
- COMPONENT_SELECTED_EVENT ("scscomponentselected")
removeComponentFromPageModel(componentId)
Removes a component from the page model given a component ID.
Parameters:
Name | Type | Description |
---|---|---|
componentId |
String | The component ID. |
renderComponent(componentId, slotId, optionsopt)
Renders the specified component. Raises the COMPONENT_RENDERED_EVENT event.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
componentId |
String | The component ID. | |||||||||||||||||||||||||||||||||||||
slotId |
String | The slot ID. | |||||||||||||||||||||||||||||||||||||
options |
Object |
<optional> |
The options object.
Properties
|
Fires:
setAudienceAttribute() → {Boolean}
This function has no effect in the design time environment.
Returns:
false
- Type
- Boolean
setAudienceAttributesReady(ready)
Sets the audience attributes ready flag.
Parameters:
Name | Type | Description |
---|---|---|
ready |
Boolean | The value to set. |
Fires:
setComponentDraggable()
Deprecated.
setComponentInstanceData(componentId, dataopt, skipUndoEntryopt)
Sets the component's internal data and optionally bypasses the undo/redo stack.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
componentId |
String | The component ID. | |
data |
Object |
<optional> |
The component instance data. |
skipUndoEntry |
Boolean |
<optional> |
Skips adding this call to the undo stack. |
setPageMetadata(property, valueopt)
Sets a page metadata property value. The property will be removed if the value parameter is undefined.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
property |
String | The property name to set the value to. | |
value |
String |
<optional> |
The value of the property. |
showLinkDeactivatedMessage()
A design-time function used to alert users of disabled links.
Events
AUDIENCE_ATTRIBUTES_READY
An event designating if audience attributes are available.
AUDIENCE_ATTRIBUTES_READY ("scsaudienceattributesready")
AUDIENCE_ATTRIBUTES_READY ("scsaudienceattributesready")
Type:
- object
Properties:
Name | Type | Description |
---|---|---|
ready |
Boolean | Flag indicating if audience attributes are available. |
COMPONENT_RENDERED_EVENT
An event designating when a given component is initialized to render itself. Asynchronous loading and rendering of the given component could happen thereafter.
COMPONENT_RENDERED_EVENT ("scscomponentrendered")
COMPONENT_RENDERED_EVENT ("scscomponentrendered")
Type:
- object
Properties:
Name | Type | Description |
---|---|---|
slotId |
String | The slot ID of where the given component will be rendered. |
containerId |
String | The container ID of where the given component will be rendered. |
componentId |
String | The component ID. |
PROFILE_CHANGED_EVENT
An event designating when audience attributes are updated.
PROFILE_CHANGED_EVENT ("scsprofilechanged")
PROFILE_CHANGED_EVENT ("scsprofilechanged")
RENDER_END_EVENT
An event designating the end of page rendering.
RENDER_END_EVENT ("scsrenderend")
RENDER_END_EVENT ("scsrenderend")
RENDER_START_EVENT
An event designating the start of page rendering.
RENDER_START_EVENT ("scsrenderstart")
RENDER_START_EVENT ("scsrenderstart")
RESET_RENDER_MODE_END
An event designating when the render mode reset is complete.
RESET_RENDER_MODE_END ("scsresetrendermodeend")
RESET_RENDER_MODE_END ("scsresetrendermodeend")
Type:
- object
Properties:
Name | Type | Description |
---|---|---|
mode |
String | The render mode after reset is complete. |
RESET_RENDER_MODE_START
An event designating when the render mode is reset.
RESET_RENDER_MODE_START ("scsresetrendermodestart")
RESET_RENDER_MODE_START ("scsresetrendermodestart")
Type:
- object
Properties:
Name | Type | Description |
---|---|---|
mode |
String | The render mode that is being reset. |