function theme_apachesolr_facet_list in Apache Solr Search 5.2
Same name and namespace in other branches
- 5 apachesolr.module \theme_apachesolr_facet_list()
- 6 apachesolr.module \theme_apachesolr_facet_list()
- 6.2 apachesolr.module \theme_apachesolr_facet_list()
3 theme calls to theme_apachesolr_facet_list()
- apachesolr_date_facet_block in ./
apachesolr.module - Helper function for displaying a date facet block.
- apachesolr_facet_block in ./
apachesolr.module - Helper function for displaying a facet block.
- apachesolr_search_taxonomy_facet_block in ./
apachesolr_search.module - Generate the facet block for a taxonomy vid delta.
File
- ./
apachesolr.module, line 1729 - Integration with the Apache Solr search application.
Code
function theme_apachesolr_facet_list($items, $display_limit = 0) {
// theme('item_list') expects a numerically indexed array.
$items = array_values($items);
// If there is a limit and the facet count is over the limit, hide the rest.
if ($display_limit > 0 && count($items) > $display_limit) {
// Show/hide extra facets.
drupal_add_js(drupal_get_path('module', 'apachesolr') . '/apachesolr.js');
// Add translated strings.
drupal_add_js(array(
'apachesolr' => array(
'showMore' => t('Show more'),
'showFewer' => t('Show fewer'),
),
), 'setting');
// Split items array into displayed and hidden.
$hidden_items = array_splice($items, $display_limit);
foreach ($hidden_items as $hidden_item) {
if (!is_array($hidden_item)) {
$hidden_item = array(
'data' => $hidden_item,
);
}
$items[] = $hidden_item + array(
'class' => 'apachesolr-hidden-facet',
);
}
}
$admin_link = '';
if (user_access('administer search')) {
$admin_link = l(t('Configure enabled filters'), 'admin/settings/apachesolr/enabled-filters');
}
return theme('item_list', $items) . $admin_link;
}