? apachesolr_cck_facet_callback-D6.patch
Index: apachesolr.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr/apachesolr.module,v
retrieving revision 1.1.2.12.2.160
diff -u -p -r1.1.2.12.2.160 apachesolr.module
--- apachesolr.module	14 Aug 2009 16:26:10 -0000	1.1.2.12.2.160
+++ apachesolr.module	22 Sep 2009 09:47:04 -0000
@@ -655,7 +655,7 @@ function apachesolr_block($op = 'list', 
 /**
  * Helper function for displaying a facet block.
  */
-function apachesolr_facet_block($response, $query, $module, $delta, $facet_field, $filter_by, $facet_callback = FALSE) {
+function apachesolr_facet_block($response, $query, $module, $delta, $facet_field, $filter_by, $facet_callback = FALSE, $facet_callback_arguments = NULL) {
   if (!empty($response->facet_counts->facet_fields->$facet_field)) {
     $contains_active = FALSE;
     $items = array();
@@ -678,7 +678,11 @@ function apachesolr_facet_block($respons
       }
 
       if ($facet_callback && function_exists($facet_callback)) {
-        $facet_text = $facet_callback($facet, $options);
+        if (isset($facet_callback_arguments) && is_array($facet_callback_arguments)) {
+          // Add additional options passed through callback.
+          $callback_options = array_merge($options, $facet_callback_arguments);
+        }
+        $facet_text = $facet_callback($facet, $callback_options);
       }
       $unclick_link = '';
       $active = FALSE;
Index: apachesolr_search.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr/apachesolr_search.module,v
retrieving revision 1.1.2.6.2.111
diff -u -p -r1.1.2.6.2.111 apachesolr_search.module
--- apachesolr_search.module	2 Jul 2009 21:58:34 -0000	1.1.2.6.2.111
+++ apachesolr_search.module	22 Sep 2009 09:47:04 -0000
@@ -652,7 +652,7 @@ function apachesolr_search_block($op = '
             foreach ($fields as $name => $field) {
               if ($field['field_name'] == $delta) {
                 $index_key = apachesolr_index_key($field);
-                return apachesolr_facet_block($response, $query, 'apachesolr_search', $delta, $index_key, t('Filter by @field', array('@field' => $field['label'])));
+                return apachesolr_facet_block($response, $query, 'apachesolr_search', $delta, $index_key, t('Filter by @field', array('@field' => $field['label'])), 'apachesolr_search_get_cck_text', array('field' => $delta));
               }
             }
           }
@@ -708,6 +708,23 @@ function apachesolr_search_get_type($fac
 }
 
 /**
+ * Callback function for the 'Filter by @field' facet block.
+ */
+function apachesolr_search_get_cck_text($facet, $options) {
+  static $info;
+  if (!isset($info)) {
+    $info = _content_type_info();
+    $info = $info['fields'];
+  }
+  $field = $info[$options['field']];
+  
+  // Clone the $facet. Do not allow altering.
+  $facet_text = $facet;
+  drupal_alter('apachesolr_search_get_cck_text', $facet_text, $facet, $field, $options);
+  return $facet_text;
+}
+
+/**
  * Implementation of hook_form_[form_id]_alter().
  *
  * This adds the 0 option to the search admin form.
