? views_taxonomy.inc-patch Index: views_taxonomy.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/views/modules/Attic/views_taxonomy.inc,v retrieving revision 1.27.2.12 diff -u -F^f -r1.27.2.12 views_taxonomy.inc --- views_taxonomy.inc 14 Jul 2007 19:30:51 -0000 1.27.2.12 +++ views_taxonomy.inc 27 Nov 2007 18:32:40 -0000 @@ -135,7 +135,16 @@ function taxonomy_views_tables() { 'handler' => 'views_handler_filter_voc', 'value-type' => 'array', 'help' => t('This will filter a view to only nodes that contain a term in the associated vocabulary.'), - ) + ), + 'term_distinct' => array( + 'name' => t('Taxonomy: Term Distinct'), + 'operator' => array('=' => 'is'), + 'list' => array('distinct' => 'distinct'), + 'handler' => 'views_handler_filter_term_distinct', + 'value-type' => 'array', + 'help' => t('This filter ensures that each term may only be listed once, even if it matches multiple criteria. Use this if multiple nodes return duplicate taxonomy terms.'), + ), + ) ); $table = views_new_table('vocabulary', 'internal', 'term_data', 'vid', 'vid'); @@ -145,6 +154,17 @@ function taxonomy_views_tables() { return $tables; } +/* + * Set a query to be distinct as a filter handler + */ +function views_handler_filter_term_distinct($op, $filter, $filterinfo, &$query) { + if (!$query->no_distinct) { + $query->set_distinct(); + $query->add_groupby('term_data.tid'); + } +} + + function taxonomy_views_arguments() { $arguments = array( 'taxid' => array(