You are here

function nodereference_count_field_options in Nodereference Count 7

Same name and namespace in other branches
  1. 6 nodereference_count.module \nodereference_count_field_options()

Generate a list of available node reference fields to count.

Parameters

$bundle: The field instance bundle.

Return value

An array of nodereference fields that are available to count.

1 call to nodereference_count_field_options()
nodereference_count_field_instance_settings_form in ./nodereference_count.module
Implements hook_field_instance_settings_form().

File

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

Code

function nodereference_count_field_options($bundle) {
  $field_types = field_info_fields();
  $field_options = array();
  foreach ($field_types as $field_type) {
    if ($field_type['type'] == 'node_reference' && isset($field_type['settings']['referenceable_types'][$bundle]) && $field_type['settings']['referenceable_types'][$bundle] === $bundle) {
      $field_options[$field_type['field_name']] = check_plain($field_type['field_name']);
    }
  }
  return $field_options;
}