doc_add_callback
doc_add_callback (doc, cbtype, callback[, "PREPEND"])
Appends callbacks to the list of callback functions to be called when a particular document-level event occurs. Two lists of callbacks are maintained for each callback type, one is document specific and the other is global (applies to all documents).
The doc parameter is a document identifier or zero (0). Using a value of zero adds the callback globally (for all documents). The cbtype parameter is the name of a callback type. The callback parameter specifies the callback function to add. The "PREPEND" flag causes the callback to placed at the beginning rather than the end of the list. Callback functions are called in the order that they appear on the list, global callbacks are called first, followed by document specific callbacks.
If doc is invalid, $ERROR is set and 0 is returned. If successful, the function returns a unique positive document identifier.
|
If callback is already on the callback list for the document, the list is shuffled to place the callback into the desired position; the callback is not added to the list a second time.
|
|
Arbortext Editor supports a single callback of each type per document. For example:
$retval = doc_add_callback(current_doc(), 'insert_entity', 'ietest') function ietest (doc, entity, op) { response("doc = " . doc . "; entity = " . entity . "; op = " . op) }
|
Refer to
Callback Functions introduction for helpful overview information. Also, refer to the following valid document callback types: