Remove or modify an Apache Solr facet link in a block

Last updated on
30 April 2025

You are browsing documentation for an older version of Drupal, which is not supported any longer, and the information may not be correct. See current documentation for Contributed modules

In your template.php, we will add the following code. It is a theme override of theme_apachesolr_facet_link()

In the following example, we check for a facet called "Tip" and exit out early before it is themed. You can add your own code here and modify the arguments as necessary.

// Theme override of apachesolr_facet_link
function [your_theme_here]_apachesolr_facet_link($facet_text, $path, $options = array(), $count, $active = FALSE, $num_found = NULL) {
  // Don't theme any facet text called 'Tip'
  if ($facet_text == 'Tip') return;

  $options['attributes']['class'][] = 'apachesolr-facet';
  if ($active) {
    $options['attributes']['class'][] = 'active';
  }
  $options['attributes']['class'] = implode(' ', $options['attributes']['class']);
  return apachesolr_l($facet_text ." ($count)",  $path, $options);
}

Help improve this page

Page status: Not set

You can: