function current_search_block_view in Facet API 7
Same name and namespace in other branches
- 6.3 contrib/current_search/current_search.block.inc \current_search_block_view()
- 7.2 contrib/current_search/current_search.block.inc \current_search_block_view()
Returns the content for a facet based on the delta.
File
- contrib/
current_search/ current_search.block.inc, line 92 - Block hook implementations and block form alterations.
Code
function current_search_block_view($delta = '') {
// Test block visibility.
$searcher = current_search_get_block_searcher($delta);
if (!current_search_check_visibility($delta)) {
return;
}
// Makes sure the adapter and configuration can be loaded.
$adapter = facetapi_adapter_load($searcher);
if ($adapter && ($config = ctools_export_crud_load('current_search', $delta))) {
$build = array();
// Iterates over configs and executes the plugins.
foreach ($config->settings['items'] as $name => $settings) {
if ($class = ctools_plugin_load_class('current_search', 'items', $settings['id'], 'handler')) {
$plugin = new $class($name, $config);
if ($return = $plugin
->execute($adapter)) {
$build[$name] = $return;
$build[$name]['#theme_wrappers'][] = 'current_search_item_wrapper';
$build[$name]['#current_search_id'] = $settings['id'];
$build[$name]['#current_search_name'] = $name;
}
}
}
// Returns the block content.
if ($build) {
$build['#contextual_links'] = array(
'current_search' => array(
'admin/config/search/current_search/list',
array(
$delta,
),
),
);
return array(
'subject' => t('Current search'),
'content' => $build,
);
}
}
}