function apachesolr_og_block in Apache Solr Search 6
Same name and namespace in other branches
- 5.2 contrib/apachesolr_og/apachesolr_og.module \apachesolr_og_block()
Implementation of hook_block().
File
- contrib/
apachesolr_og/ apachesolr_og.module, line 138 - Integrates Organic Group info with Apache Solr search application.
Code
function apachesolr_og_block($op = 'list', $delta = 0, $edit = array()) {
switch ($op) {
case 'list':
$enabled_facets = apachesolr_get_enabled_facets('apachesolr_og');
$facets = apachesolr_og_apachesolr_facets();
// Add the blocks
$blocks = array();
foreach ($enabled_facets as $delta => $facet_field) {
if (isset($facets[$delta])) {
$blocks[$delta] = $facets[$delta] + array(
'cache' => BLOCK_CACHE_PER_ROLE | BLOCK_CACHE_PER_PAGE,
);
}
}
return $blocks;
case 'view':
if (apachesolr_has_searched()) {
if ($delta != _apachesolr_og_gid_key()) {
return;
}
$response = apachesolr_static_response_cache();
if (empty($response)) {
return;
}
$query = apachesolr_current_query();
return apachesolr_facet_block($response, $query, 'apachesolr_og', $delta, $delta, t('Filter by Group'), 'apachesolr_og_group_name');
}
break;
case 'configure':
return apachesolr_facetcount_form('apachesolr_og', $delta);
case 'save':
apachesolr_facetcount_save($edit);
break;
}
}