Arbortext Command Language > Hooks > entityflattenhook
  
entityflattenhook
entityflattenhook
Function prototype:
hook (oid)
Synopsis
Use with:
add_hook(hookname, func)
remove_hook(hookname, func)
where hookname is entityflattenhook.
This hook will be called when flattening entity references in a document. The hook will be called each time the process encounters a region inside a _file_ent or _text_ent processing instruction tag pair.
Argument
oid is the oid of a processing instruction “tag pair” that wraps the contents of the entity, at the place where the flattened entity will appear in the saved document. This tag pair is the same as would wrap the entity if it were displayed inline using View > File Entities, or View > Text Entities (that is, oid_name(oid) will return either _file_ent or _text_ent.
If the hook returns -1, that entity reference will not be flattened, but will be left displayed inline, wrapped by the _file_ent or _text_ent tag pair. Any other return value will result in the entity being flattened.
* 
It is not possible for the hook to alter the wrapper pair or the contents of the entity (as it is a protected region). The hook can, however, either delete the entire entity (in which case it must return -1), or insert custom processing instructions around the wrapper pair so after the wrapper pair is deleted, you will retain information about former entity boundaries.