Server side events:

For data manipulations, tree offers Before and After events (after events doesn't have the 'after' prefix). most listeners receive an 'object' parameter that is the result of json_decode function. One of the object properties are id and type that are the 'id' of the object and its 'type'.

Notice beforeCreate event doesn't have an 'id' yet

List of types:

  • 1 - folder
  • 2 - link
  • 3 - case
  • 4 - object
  • 5 - file
  • 6 - task
  • 7 - event

Notice No events are tiggered for types 1 and 2 for now

CaseBox tree events:

  • beforeNodeDbCreate (object): the JSON comes from clientside, you can modify it before CaseBox creates the actual record in DB
  • nodeDbCreate(object)
  • beforeNodeDbUpdate(object)
  • nodeDbUpdate(object)
  • beforeNodeDbDelete(node_id/ids array)
  • nodeDbDelete(node_id/ids array)
  • beforeNodeSolrUpdate (solr_object)
  • nodeSolrUpdate (solr_object)

In the example below, the event beforeNodeDBUpdate has a handler attached called onBeforeObjectSave located in ObjectHandler php class. The PHP file should be added to /cores/[core]/php/ folder. Notice that you can attach several handlers from different PHP classes.