You are here

function node_reference_views_filter_options in References 7.2

Options: 'options callback' for the views_handler_filter_in_operator filter.

Parameters

string $field_name: The field name.

1 string reference to 'node_reference_views_filter_options'
node_reference_field_views_data in node_reference/node_reference.module
Implements hook_field_views_data().

File

node_reference/node_reference.module, line 1301
Defines a field type for referencing one node from another.

Code

function node_reference_views_filter_options($field_name) {
  $options = array();
  if ($field = field_info_field($field_name)) {
    $options = _node_reference_options($field, TRUE);

    // The options are displayed in checkboxes within the filter admin form, and
    // in a select within an exposed filter. Checkboxes accept HTML, other
    // entities should be encoded; selects require the exact opposite: no HTML,
    // no encoding. We go for a middle ground: strip tags, leave entities
    // unencoded.
    foreach ($options as $key => $value) {
      $options[$key] = strip_tags($value);
    }
  }
  return $options;
}