You are here

function nodereference_count_get_nodereference_fields in Nodereference Count 7

Get an array of node reference fields for a particular node bundle.

Parameters

$bundle: The content type for which we want a list of node reference fields.

Return value

An array of fields.

1 call to nodereference_count_get_nodereference_fields()
nodereference_count_references_update in ./nodereference_count.module
Identify counted node references on a node and trigger an update of the referenced nodes.

File

./nodereference_count.module, line 274
Defines a field type for counting the references to a node.

Code

function nodereference_count_get_nodereference_fields($bundle) {
  $nodereference_fields = array();
  $fields = field_info_fields();
  foreach ($fields as $field) {
    if ($field['type'] == 'node_reference' && isset($field['bundles']['node']) && in_array($bundle, $field['bundles']['node'])) {
      $nodereference_fields[$field['field_name']] = $field;
    }
  }
  return $nodereference_fields;
}