You are here

function countries_apachesolr_display_callback in Countries 7.2

Same name and namespace in other branches
  1. 8 countries.module \countries_apachesolr_display_callback()

Returns the country name to be used in the facet.

Parameters

string $facet: The indexed value.

array $options: An array of options including the hook_block $delta.

1 string reference to 'countries_apachesolr_display_callback'
countries_apachesolr_field_mappings in ./countries.module
Implements hook_apachesolr_field_mappings().

File

./countries.module, line 1100
Defines the field and entity information for countries.

Code

function countries_apachesolr_display_callback($facet, $options) {
  $fields = field_info_fields();
  $field_name = $options['delta'];
  if (isset($fields[$field_name])) {
    $allowed_values = list_allowed_values($field);
    if (isset($allowed_values[$facet])) {
      $country = country_load($allowed_values[$facet]);
    }
  }
  else {
    $country = country_load($allowed_values[$facet]);
  }
  if ($country) {
    return check_plain(countries_t($country, 'name'));
  }
  return '';
}