function search_api_et_fulltext_get in Search API Entity Translation 7
Getter callback for fulltext property.
Concatenate the entity rendering for all its language versions/translations.
1 string reference to 'search_api_et_fulltext_get'
File
- ./
search_api_et.module, line 36 - Offers simple support for search api for searching in multilingual nodes translated with the entity translation module.
Code
function search_api_et_fulltext_get($item, $options, $name, $type, $info) {
$view_mode = variable_get('search_api_et_fulltext_get_viewmode_' . $type, 'search_index');
// If no translations are managed for this entity (i.e. ET is not activated),
// do nothing.
if (!is_array($item->translations->data)) {
return;
}
// Iterate through the $item->translations to render the entity in each lang.
$fulltext = '';
foreach ($item->translations->data as $langcode => $translation) {
if ($translation['status']) {
$render = entity_view($type, array(
$item,
), $view_mode, $langcode);
$context = array(
'item' => $item,
'options' => $options,
'name' => $name,
'type' => $type,
'view_mode' => $view_mode,
'language' => $langcode,
);
// Invoke some hooks, before or after the rendering, for alterations.
drupal_alter('search_api_et_fulltext_prerender', $render, $context);
$render = drupal_render($render);
drupal_alter('search_api_et_fulltext_postrender', $render, $context);
$fulltext .= $render;
}
}
return $fulltext;
}