Implementing a Custom Content Handler 
The content handler is responsible for receiving notifications on modifications made to the content items in the context of the page that is being edited. These notifications enable you to manage the full life cycle of a content item.
The content handler handles various notifications, such as:
|
Notification |
Description |
Return Value |
|---|---|---|
|
onCreate |
Triggered when adding a content item to a page |
A map of property modifications to perform on the created design-time object. |
|
onBeforeDelete |
Triggered just before deleting a content item from a page |
None |
|
onCopy, onMove |
Triggered when copying or moving a content item |
A map of property modifications to perform on the created design-time object. |
|
onPublish |
Triggered during page publication |
A map of property modifications to perform on the created runtime object. |
|
onUnpublish |
Triggered during page removal |
None |
As shown in the Return Value column in the table above, some APIs return a map of property modifications. You can use the returned values to modify, if necessary, any relevant properties in the template from which the content item was created.
For example, if you manage a separate repository for your custom content, upon an onCreate event, you may need to perform additional actions on your own repository, such as create a new entry that represents the newly added content item.
Once you have completed updating your repository, you may also want to reflect some of the changes made to your repository, back onto the content item created in WPC. For example, update the custom location (in your repository) from which to render the content item. Note that such properties should not be modified manually, but rather, they should be returned by the property map for the WPC infrastructure to handle.