function apachesolr_search_page_list_blocks in Apache Solr Search 7
Same name and namespace in other branches
- 8 apachesolr_search.admin.inc \apachesolr_search_page_list_blocks()
- 6.3 apachesolr_search.admin.inc \apachesolr_search_page_list_blocks()
Listing of all the search blocks
Return value
array $build
1 call to apachesolr_search_page_list_blocks()
- apachesolr_search_page_list_all in ./
apachesolr_search.admin.inc - Menu callback for the overview page showing custom search pages and blocks.
File
- ./
apachesolr_search.admin.inc, line 132 - Administrative settings for searching.
Code
function apachesolr_search_page_list_blocks() {
$build = array();
$rows = array();
// Build the sortable table header.
$header = array(
'label' => array(
'data' => t('Name'),
'field' => 's.label',
),
'environment' => array(
'data' => t('Search environment'),
),
'operations' => array(
'data' => t('Operations'),
),
);
$search_blocks = variable_get('apachesolr_search_mlt_blocks', array());
foreach ($search_blocks as $search_block_id => $search_block) {
$row = array();
// Add the label
$label = check_plain($search_block['name']);
$row[] = $label;
// Add the search environment
$environment = apachesolr_environment_load($search_block['mlt_env_id']);
$row[] = $environment ? check_plain($environment['name']) : check_plain(t('<Disabled>'));
// Operations
if (module_exists('block')) {
$row[] = array(
'data' => l(t('Configure'), 'admin/structure/block/manage/apachesolr_search/' . $search_block_id . '/configure', array(
'query' => array(
'destination' => current_path(),
),
)),
);
}
$row[] = array(
'data' => l(t('Delete'), 'admin/config/search/apachesolr/search-pages/block/' . $search_block_id . '/delete'),
);
$rows[$search_block_id] = $row;
}
// Automatically enlarge our header with the operations size
$header['operations']['colspan'] = count(reset($rows)) - 2;
$build['list'] = array(
'#prefix' => '<h3>Blocks "More Like This"</h3>',
'#theme' => 'table',
'#header' => $header,
'#rows' => array_values($rows),
'#empty' => t('No available search blocks.'),
);
$build['pager'] = array(
'#theme' => 'pager',
'#quantity' => 20,
'#weight' => 10,
);
return $build;
}