Commit a8aa7cdb authored by David Lesieur's avatar David Lesieur

Made some code clearer.

parent de5cf52f
......@@ -6,9 +6,6 @@
* Provides an API for modules to expose facets based on CCK fields.
*/
// TODO: A way to select formatters other than the default one.
// TODO: Facet key should simply be the field name.
require_once('./'. drupal_get_path('module', 'faceted_search') .'/faceted_search.inc');
/**
......@@ -195,7 +192,7 @@ class cck_facet_category extends faceted_search_category {
$main_column = array_shift($db_info['columns']);
// Since the same table might be joined multiple times in the query, we use
// the field's name as the table alias to create a unique table reference.
$query->add_table($db_info['table'], 'vid', 'n', 'vid', $this->_field['field_name']);
$table = $query->add_table($db_info['table'], 'vid', 'n', 'vid', $this->_field['field_name']);
switch($main_column['type']) {
case 'int':
case 'mediumint':
......@@ -209,7 +206,7 @@ class cck_facet_category extends faceted_search_category {
default:
$placeholder = "'%s'";
}
$query->add_where($this->_field['field_name'] .'.'. $main_column['column'] .' = '. $placeholder, $this->_value);
$query->add_where($table .'.'. $main_column['column'] .' = '. $placeholder, $this->_value);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment