You are here

function countries_apachesolr_display_callback in Countries 8

Same name and namespace in other branches
  1. 7.2 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 1102
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) {

    // @todo Do we have language context here?
    return country_property($country);
  }
  return '';
}