function apachesolr_search_page_list_pages in Apache Solr Search 8
Same name and namespace in other branches
- 6.3 apachesolr_search.admin.inc \apachesolr_search_page_list_pages()
- 7 apachesolr_search.admin.inc \apachesolr_search_page_list_pages()
Listing of all the search pages
Return value
array $build
1 call to apachesolr_search_page_list_pages()
- 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 51 - Administrative settings for searching.
Code
function apachesolr_search_page_list_pages() {
$build = array();
$rows = array();
$rows['core_search'] = array();
// Build the sortable table header.
$header = array(
'label' => array(
'data' => t('Name'),
'field' => 's.label',
),
'path' => array(
'data' => t('Path'),
'field' => 's.search_path',
),
'environment' => array(
'data' => t('Search environment'),
),
'operations' => array(
'data' => t('Operations'),
),
);
$search_pages = apachesolr_search_load_all_search_pages();
$default_search_page = apachesolr_search_default_search_page();
foreach ($search_pages as $search_page) {
$row = array();
// Add the label
$label = check_plain($search_page['label']);
// Is this row our default environment?
if ($search_page['page_id'] == $default_search_page) {
$label = t('!search_page <em>(Default)</em>', array(
'!search_page' => $label,
));
}
$row[] = $label;
// Add the link
$row[] = array(
'data' => array(
'#type' => 'link',
'#title' => $search_page['search_path'],
'#href' => $search_page['search_path'],
),
);
// Add the search environment
$environment = apachesolr_environment_load($search_page['env_id']);
$row[] = $environment ? check_plain($environment['name']) : check_plain(t('<Disabled>'));
// Operations
$row[] = array(
'data' => l(t('Edit'), 'admin/config/search/apachesolr/search-pages/' . $search_page['page_id'] . '/edit'),
);
$row[] = array(
'data' => l(t('Clone'), 'admin/config/search/apachesolr/search-pages/' . $search_page['page_id'] . '/clone'),
);
// Allow to revert a search page or to delete it
if (!isset($search_page['settings']['apachesolr_search_not_removable']) && !isset($search_page['in_code_only'])) {
if (isset($search_page['type']) && $search_page['type'] == 'Overridden') {
$row[] = array(
'data' => l(t('Revert'), 'admin/config/search/apachesolr/search-pages/' . $search_page['page_id'] . '/delete'),
);
}
else {
$row[] = array(
'data' => l(t('Delete'), 'admin/config/search/apachesolr/search-pages/' . $search_page['page_id'] . '/delete'),
);
}
}
else {
$row[] = '';
}
$rows[$search_page['page_id']] = $row;
}
// Automatically enlarge our header with the operations size
$header['operations']['colspan'] = count(reset($rows)) - 3;
$build['list'] = array(
'#prefix' => '<h3>Pages</h3>',
'#theme' => 'table',
'#header' => $header,
'#rows' => array_values($rows),
'#empty' => t('No available search pages.'),
);
$build['pager'] = array(
'#theme' => 'pager',
'#quantity' => 20,
'#weight' => 10,
);
return $build;
}