You are here

function countries_apachesolr_indexing_callback in Countries 8

Same name and namespace in other branches
  1. 7.2 countries.module \countries_apachesolr_indexing_callback()

Callback that converts countries module field into an array.

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

File

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

Code

function countries_apachesolr_indexing_callback($entity, $field_name, $index_key, $field_info) {
  $fields = array();
  if (!empty($entity->{$field_name})) {
    $field = $entity->{$field_name};
    list($lang, $values) = each($field);
    foreach ($values as $fval) {
      $fields[] = array(
        'key' => $index_key,
        'value' => $fval['iso2'],
      );
    }
  }
  return $fields;
}