Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

To subscribe the event handler, the subscribe method on the Event Manager service must be invoked. The subscribe method takes, in addition to the event handler, an event type and a desired scope as input arguments. The event type may be PRE or POST. The scope indicates the object type on which the event applies. For the basic events the appropriate scopes are mentioned in the event overview table. It is also possible to provide a superclass or interface as scope. For example, to receive all PageVersion events, you can subscribe to events with either scope PageEvent.class, or any class it extends or interface it implements.

...

  • A plugin should never publish a CHANGED event. This is the history service’s responsibility and it will publish it if a content item has changed. Even if you are certain the content item has changed, an UPDATE event should be published.
  • An UPDATE event should be published only once. When multiple properties have changed, publish an event for all the properties at once and not individually.
  • When publishing an event, both the PRE and POST event should be copied unless only a POST event is published (see the event overview table). The PRE event should be published before applying any change, and the POST event should be published thereafter.
  • If available, the most specific implementation of an event should be used. For example, if a page has been updated, publish a PageEvent instead of an EntityEvent with scope Page.class.

...