close

Filter

loading table of contents...

Studio Developer Manual / Version 2107

Table Of Contents

7.3.7 Client-side initialization of new Documents

With a content initializer you can initialize the properties of a newly created document. A content initializer will be called while a new content object is being created by the NewContentAction. Only one initializer can be defined for each document type. You must register custom initializers with the IEditorContext class. Simply call the registerContentInitializer(contentTypeName, initializer) method.

The following code defines a simple initializer that sets the content's language property to German by default:

editorContext.registerContentInitializer("CMTeaser", initLanguage);
...
private function initLanguage(content:Content):void {
  var properties:ContentProperties = content.getProperties();
  properties.set('lang', 'de');
}

Example 7.22. Defining a content initializer


Client-side initialization might be sufficient for simple initialization scenarios. If you have complex requirements, consider using server-side initialization: Refer to Section 7.18.2, “Intercepting Write Requests” for details.

Search Results

Table Of Contents
warning

Your Internet Explorer is no longer supported.

Please use Mozilla Firefox, Google Chrome, or Microsoft Edge.