function apachesolr_search_page_browse in Apache Solr Search 8
Same name and namespace in other branches
- 6.3 apachesolr_search.module \apachesolr_search_page_browse()
- 7 apachesolr_search.module \apachesolr_search_page_browse()
Handle browse results for empty searches.
1 call to apachesolr_search_page_browse()
- apachesolr_search_search_page_custom in ./
apachesolr_search.module - Mimics apachesolr_search_search_page() but is used for custom search pages We prefer to keep them seperate so we are not dependent from core search when someone tries to disable the core search
File
- ./
apachesolr_search.module, line 976 - Provides a content search implementation for node content for use with the Apache Solr search application.
Code
function apachesolr_search_page_browse($empty_search_behavior, $env_id) {
$build = array();
// Switch in case we come up with new flags.
switch ($empty_search_behavior) {
case 'browse':
if (module_exists('facetapi') && ($query = apachesolr_current_query($env_id))) {
module_load_include('inc', 'facetapi', 'facetapi.block');
// Get facet render elements.
$searcher = $query
->getSearcher();
$elements = facetapi_build_realm($searcher, 'block');
$build = array();
foreach (element_children($elements) as $key) {
$delta = "facetapi_{$key}";
// @todo: order/filter these pseudo-blocks according to block.module weight, visibility (see 7.x-1beta4)
$block = new stdClass();
$block->visibility = TRUE;
$block->enabled = TRUE;
$block->module = 'facetapi';
$block->subject = theme('facetapi_title', array(
'title' => $elements[$key]['#title'],
));
$build[$delta] = $elements[$key];
$block->region = NULL;
$block->delta = 'apachesolr-' . $key;
// @todo: the final themed block's div id attribute does not coincide with "real" block's id (see facetapi_get_delta_map())
$build[$delta]['#block'] = $block;
$build[$delta]['#theme_wrappers'][] = 'block';
$build['#sorted'] = TRUE;
}
$build['#theme_wrappers'][] = 'apachesolr_search_browse_blocks';
}
break;
}
return $build;
}