function apachesolr_multilingual_apachesolr_search_page_alter in Apache Solr Multilingual 7
Same name and namespace in other branches
- 6.3 apachesolr_multilingual.module \apachesolr_multilingual_apachesolr_search_page_alter()
Modify the build array for any search output build by Apache Solr This includes core and custom pages and makes it very easy to modify both of them at once
Parameters
array $build:
array $search_page:
File
- ./
apachesolr_multilingual.module, line 964 - Multilingual search using Apache Solr.
Code
function apachesolr_multilingual_apachesolr_search_page_alter(array &$build, array $search_page) {
if (apachesolr_has_searched($search_page['env_id'])) {
$environment = apachesolr_multilingual_environment_load($search_page['env_id']);
$settings = $environment['conf']['apachesolr_multilingual_index_settings'];
if ($settings['apachesolr_multilingual_index']) {
$languages = apachesolr_multilingual_language_list();
$filter_languages =& drupal_static('apachesolr_multilingual_filter_languages_' . $search_page['page_id']);
// Retrieve suggestion
$suggestions = apachesolr_multilingual_get_search_suggestions($search_page['env_id'], $filter_languages);
if (!empty($suggestions)) {
$build['suggestions']['#links'] = array();
foreach ($suggestions as $language_id => $suggestion) {
$build['suggestions']['#links'][] = (1 == count($filter_languages) ? '' : $languages[$language_id] . ': ') . l($suggestion, $search_page['search_path'] . '/' . $suggestion);
}
}
}
}
}