Arbortext Command Language > Callbacks > doc_add_callback > insert_entity Callback Type
  
insert_entity Callback Type
Function prototype:
function funcname (doc, entity, op)
insert_entity is called by the insert_entity command before the entity reference is inserted. If the callback function inserts the reference itself, for example, using the insert function, it should return -1.
Arguments
doc is the identifier of the current document.
entity is the name of the entity reference to insert. The name is prefixed with the entity reference open character '&'.
op is the function callback operation. Callbacks are called twice in succession with op specifying the stage of callback operation.
1. op == 1 first call — The returned argument specifies whether the execution should continue or be stopped:
0 — Continue callback processing.
-1 — Stop further callback processing.
2. op == 2 second call — Occurs unless the processing was stopped during the first call. The returned argument allows or prevents basic Arbortext Editor processing after all callbacks have been called:
0 — Basic Arbortext Editor processing allowed.
-1 — Basic Arbortext Editor processing prevented.