You are here

function apachesolr_multilingual_apachesolr_field_mappings_alter in Apache Solr Multilingual 7

Same name and namespace in other branches
  1. 6.3 apachesolr_multilingual.module \apachesolr_multilingual_apachesolr_field_mappings_alter()

Implements hook_apachesolr_field_mappings_alter()

File

./apachesolr_multilingual.module, line 1026
Multilingual search using Apache Solr.

Code

function apachesolr_multilingual_apachesolr_field_mappings_alter(&$mappings, $entity_type) {
  $multilingual_mapping = array(
    'apachesolr_nodereference_indexing_callback' => 'apachesolr_multilingual_nodereference_indexing_callback',
    'apachesolr_userreference_indexing_callback' => 'apachesolr_multilingual_userreference_indexing_callback',
    'apachesolr_entityreference_indexing_callback' => 'apachesolr_multilingual_entityreference_indexing_callback',
    'apachesolr_term_reference_indexing_callback' => 'apachesolr_multilingual_term_reference_indexing_callback',
    'apachesolr_fields_default_indexing_callback' => 'apachesolr_multilingual_fields_default_indexing_callback',
  );
  foreach ($mappings as &$mapping) {
    if (isset($mapping['indexing_callback']) && is_array($mapping['indexing_callback'])) {
      foreach ($mapping['indexing_callback'] as $key => $value) {
        if (isset($multilingual_mapping[$value])) {
          $mapping['indexing_callback'][$key] = $multilingual_mapping[$value];
        }
      }
    }
  }
}