loading table of contents...

7.3.9. 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.

Example

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.23. 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.15.2, “Intercepting Write Requests” for details.