Reference Field: Difference between revisions

From IHRIS Wiki
(Created page with 'This describe the magic data structure used for defining a REFERENCE field. These options all live under /modules/forms/formClasses/$form…')
 
Line 4: Line 4:




==Referenced Forms==
==Magic Data Structure==
 
*display: required parent node.  names of sub-nodes are the names of the forms that this field can reference. 
**$refForm: required parent node.  The name of the node, $refForm, is a form that this field can reference.
***default: required parent node.  The default display for the referenced form
****printf: required (translatable) scalar node.  A string which will get passed to printf to display the node.  Example is "%s %s" which contains two substitutions
****printf_args: required parent node:  Sub-nodes should be ordered integers.  requires 0..n sub-nodes if the printf contains (n+1) substutions.
*****0: required scalar node the name of the first field whose display value is passed to printf
*****1: requried scalar node the name of the next field whose display value is passed to printf
*****...
*****n: requried scalar node the name of the last field whose display value is passed to printf
***$display: optional parent node.  Another named display for this field.  Sub-nodes are exactly the same as those defined for default
 
A REFERENCE field is only considered valid if the form it references, $refForm, is one who has a node under display.

Revision as of 09:01, 11 February 2011

This describe the magic data structure used for defining a REFERENCE field. These options all live under

/modules/forms/formClasses/$formClass/fields/$field

for the given form class $formClass and field name $field.


Magic Data Structure

  • display: required parent node. names of sub-nodes are the names of the forms that this field can reference.
    • $refForm: required parent node. The name of the node, $refForm, is a form that this field can reference.
      • default: required parent node. The default display for the referenced form
        • printf: required (translatable) scalar node. A string which will get passed to printf to display the node. Example is "%s %s" which contains two substitutions
        • printf_args: required parent node: Sub-nodes should be ordered integers. requires 0..n sub-nodes if the printf contains (n+1) substutions.
          • 0: required scalar node the name of the first field whose display value is passed to printf
          • 1: requried scalar node the name of the next field whose display value is passed to printf
          • ...
          • n: requried scalar node the name of the last field whose display value is passed to printf
      • $display: optional parent node. Another named display for this field. Sub-nodes are exactly the same as those defined for default

A REFERENCE field is only considered valid if the form it references, $refForm, is one who has a node under display.