You are here

function user_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.

Return value

array The array of allowed options for the filter.

1 string reference to 'user_reference_views_filter_options'
user_reference_field_views_data in user_reference/user_reference.module
Implements hook_field_views_data().

File

user_reference/user_reference.module, line 1266
Defines a field type for referencing a user from a node.

Code

function user_reference_views_filter_options($field_name) {
  $options = array();
  if ($field = field_info_field($field_name)) {
    $options = _user_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;
}