Arbortext Command Language > Callbacks > doc_add_callback > reference_modify Callback Type
  
reference_modify Callback Type
Function prototype:
function funcname (doc, oid, prevvalarr)
reference_modify is called whenever a reference attribute has been added or modified. It is not called when a reference attribute is deleted. When reference_modify is called, any additions or changes to an attribute have already been made in the document. The callback is called once per element, even if more than one reference attribute for an element is being added or changed. If one or more modifications are being made as part of a single operation that modifies several elements, the callback is called once for each element. Note that if changes to reference attribute values are made from a reference_modify callback, the callback is not called again for these changes.
Arguments
doc is the identifier of the document containing the reference or references for which the value is being added or changed.
oid is the object identifier of the element containing the reference or references for which the value is being added or changed.
prevvalarr is an associative array with an entry for each reference attribute that is changed. The array is indexed by the reference attribute name. The values are the original values of the reference attributes before the change. These values can be used by the callback to restore a particular element and attribute to its previous value.
The return value of the callback function is ignored and should be zero.
* 
The reference_modify callback type is currently used only for DITA references.
Multiple reference_modify callbacks can be registered. Due to this, the callbacks need to be written to guard against the case where one callback deletes an element or attribute from the document, making some of the information (oid, attribute name, or previous value in prevvalarr) passed to later callbacks invalid or inconsistent.