We begin with some sub-macros used within macro "show" defined below. Displays the title of a referenced object, with a link on it to reach the consult view for this object. If we are on a back reference, the link allows to reach the correct page where the forward reference is defined. If we are on a forward reference, the "nav" parameter is added to the URL for allowing to navigate from one object to the next/previous on ui/view. Displays icons for triggering actions on a given referenced object (edit, delete, etc). EditDeleteUnlinkArrows for moving objects up or down
Displays the "plus" icon that allows to add new object through a reference widget. Indeed, If field was declared as "addable", we must provide an icon for creating a new linked object (at least if multiplicities allow it). This macro displays, in a cell header from a ref table, icons for sorting the ref field according to the field that corresponds to this column. View macro for a Ref. This macro is called by a XmlHttpRequest (or directly by the macro above) for displaying the referred objects of a reference field.
This macro displays the Reference widget on a "view" page. The definition of "atMostOneRef" above may sound strange: we shouldn't check the actual number of referenced objects. But for back references people often forget to specify multiplicities. So concretely, multiplicities (0,None) are coded as (0,1). Display a simplified widget if maximum number of referenced objects is 1. If there is no object... If there is an object...
Display a table in all other cases.
() The search icon if field is queryable
Appy (top) navigation No object is present

Show forward or backward reference(s)
Appy (bottom) navigation
Edit macro for an Ref. Cell macro for a Ref. Search macro for a Ref.
   The "and" / "or" radio buttons
The list of values