Facet API - Rewrite facet items via callback function I'm trying to rewrite the link text in an Apache Solr facet block, specifically the one to drill down by bundle/content type. By default the block displays the human readable name of the content type. I want to avoid simply editing the name as this would affect other things in the site.

So, in the block I would rather have a custom text such as 'Music Videos' rather than 'Article' from the 'article' content type.  

I hoped to use the hooks created by Facet API Bonus to rewrite facet items via callback function, but am having difficulty getting the code to work. 

Here is what I have, based on material from here and in the Facet API Bonus module readme:

function custom_module_facet_items_alter(&amp;$build, &amp;$settings)
 {
  if ($settings-&gt;facet == "apachesolr@solr:block:bundle") {
   {
    foreach ($build as $key =&gt; $item)
     {
      switch ($key)
      {
        case 'article':
          $build['article']['#markup'] = 'Music Videos';
          break;
      }
     }
   }
 }


I'm using Drupal 7.27, Facet API 7.x-1.5 and Facet API Bonus 7.x-1.1 . 

Thanks in advance for any help.
Make sure this filter is selected for your facet(s): "Rewrite facet items via callback function"
admin/config/search/apachesolr/settings > Facets > YOUR FACET > configure filters > [x] Rewrite facet items via callback function
You can verify your hook is implemented using drush and devel module:



drush hook facet_items_alter
Enter the number of the hook implementation you wish to view.
[0]  :  Cancel
[1]  :  my_module_name


If you see something similar to above, then your hook is implemented. To see the implementation code, enter a number (1 in this example).