Project:CCK Facets
Version:5.x-1.0-beta2
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

I made a site with quite a few node reference facets.

It was perceived as unclear when someone clicked on the title of a node (in the facet), nothing was shown for that node, but only the nodes where that node is referenced.

I made a hack in the theme, but I think it could be a configurable option to be able to show some information of the referenced node when it is used in the faceted search.

function phptemplate_faceted_search_ui_page($search, $content) {
  $classes = array(
    'faceted-search-page',
    'faceted-search-stage-'. $search->ui_state['stage'],
    'faceted-search-env-'. faceted_search_variable_get($search->get_env_id(), 'name', 'faceted_search'),
  );
 
//display node information if a node reference is selected
  $itemstxt = "";
  foreach ($search->_filters as $filter)
  {
     $type = $filter->_field['type'];
    
     foreach ($filter->_path as $path)
     {
    
       $label = $filter->get_label();   
    
       if ($type == 'nodereference')
        {
          $value = $path->_value;

          if ($value)
          {        
             $node = node_load($value);

             if ($node) $items[] = $label." : ".l($node->title, "node/$value");
          }
        }
        else
        {
            $value = $path->get_label(TRUE);  
            $items[] = $label." : ".$value;
        }
    

    }   
    if ($items) $itemstxt = theme('item_list', $items, "U heeft gezocht op");
  }
 
   return '<div class="'. implode(' ', $classes) .'">'.$itemstxt. $content .'</div>'."\n";
}
nobody click here