I was wondering if someone (possibly one of the project maintainers) could post an example of how to programmatically create a reference field.

Something along the lines of :

$form['foo'] = array(
  '#type' => 'node_reference',
  ... list of attributes and brief description here ...

would be more than sufficient for many of us.

I'm assuming that as a field that uses the Field API, it should be quite easy to add a reference field to a form using the standard Form API, but without any documentation, many of us developers are at a loss to both help respond to questions in this issue queue or to accomplish the functionality that we'd like with References.



Has anyone figured out how to do this? I'm a little shaky on this part of the Form API, but I think that the module would need to implement hook_element_info() in order to make the node or user reference fields available to the Form API for use in custom forms.