You are here

function apachesolr_multilingual_nodereference_indexing_callback_implementation in Apache Solr Multilingual 7

Indexing callback for the node_reference module by the references module

Parameters

object $entity:

string $field_name:

string $index_key:

array $field_info:

Return value

array $fields

1 call to apachesolr_multilingual_nodereference_indexing_callback_implementation()
apachesolr_multilingual_nodereference_indexing_callback in ./apachesolr_multilingual.module
Indexing callback for the node_reference module by the references module

File

./apachesolr_multilingual.index.inc, line 185

Code

function apachesolr_multilingual_nodereference_indexing_callback_implementation($entity, $field_name, $index_key, array $field_info) {
  $fields = array();
  if (!empty($entity->{$field_name})) {
    if (array_key_exists($entity->language, $entity->{$field_name})) {
      $index_key = apachesolr_index_key($field_info);
      foreach ($entity->{$field_name}[$entity->language] as $reference) {
        if ($index_value = !empty($reference['nid']) ? $reference['nid'] : FALSE) {
          $fields[] = array(
            'key' => $index_key,
            'value' => $index_value,
          );
        }
      }
    }
    else {
      return apachesolr_nodereference_indexing_callback($entity, $field_name, $index_key, $field_info);
    }
  }
  return $fields;
}