You are here

function apachesolr_nodereference_map_callback in Apache Solr Search 8

Same name and namespace in other branches
  1. 6.3 apachesolr.module \apachesolr_nodereference_map_callback()
  2. 7 apachesolr.module \apachesolr_nodereference_map_callback()

Parameters

$facet string: The indexed value @param $options An array of options including the hook_block $delta. @see http://drupal.org/node/1059372

1 string reference to 'apachesolr_nodereference_map_callback'
node_reference_apachesolr_field_mappings in ./apachesolr.module
Implements hook_apachesolr_field_mappings() on behalf of References (node_reference).

File

./apachesolr.module, line 2262
Integration with the Apache Solr search application.

Code

function apachesolr_nodereference_map_callback($facets, $options) {
  $map = array();
  $allowed_values = array();

  // @see list_field_formatter_view()
  $fields = field_info_fields();
  $field_name = $options['field']['field_name'];
  if (isset($fields[$field_name])) {
    $allowed_values = node_reference_potential_references($fields[$field_name]);
  }
  foreach ($facets as $key) {
    if (isset($allowed_values[$key])) {
      $map[$key]['#markup'] = field_filter_xss($allowed_values[$key]['title']);
    }
    elseif ($key === '_empty_' && !empty($options['facet missing allowed'])) {

      // Facet missing.
      $map[$key]['#markup'] = theme('facetapi_facet_missing', array(
        'field_name' => $options['display_name'],
      ));
    }
    else {
      $map[$key]['#markup'] = field_filter_xss($key);
    }

    // The value has already been filtered.
    $map[$key]['#html'] = TRUE;
  }
  return $map;
}