diff -upr tagadelic_views.orig/theme/theme.inc tagadelic_views/theme/theme.inc --- tagadelic_views.orig/theme/theme.inc 2009-10-06 02:07:19.000000000 +1300 +++ tagadelic_views/theme/theme.inc 2009-11-01 20:57:20.000000000 +1300 @@ -11,10 +11,24 @@ function template_preprocess_views_view_ $options = $view->style_plugin->options; - foreach ($view->result as $node) { - $nids[] = $node->nid; + /* Handle Term and Node views */ + switch($view->base_table) + { + case "term_data": + $base_field_name = 'd.tid'; + foreach ($view->result as $term) { + $ids[] = $term->tid; + } + break; + case "node": + default: + $base_field_name = 'n.nid'; + foreach ($view->result as $node) { + $ids[] = $node->nid; + } + break; } - $nid_restrictor = '('. implode(',', $nids) .')'; + $base_restrictor = '('. implode(',', $ids) .')'; if ($options['vocab'] != '') { $vocabs_selected = split(',', $options['vocab']); @@ -45,7 +59,7 @@ function template_preprocess_views_view_ $vars['output'] = 'Could not find '. implode(', ', $vocabs_selected) .'!'; } else { - $result = db_query_range('SELECT COUNT(*) AS count, d.tid, d.name, d.vid FROM {term_data} d INNER JOIN {term_node} n ON d.tid = n.tid WHERE n.nid IN '. $nid_restrictor . $vid_restrictor .' GROUP BY d.tid, d.name, d.vid ORDER BY count DESC', 0, $options['size']); + $result = db_query_range('SELECT COUNT(*) AS count, d.tid, d.name, d.vid FROM {term_data} d INNER JOIN {term_node} n ON d.tid = n.tid WHERE '.$base_field_name.' IN '. $base_restrictor . $vid_restrictor .' GROUP BY d.tid, d.name, d.vid ORDER BY count DESC', 0, $options['size']); $tags = tagadelic_build_weighted_tags($result, $options['steps']); $tags = tagadelic_sort_tags($tags); if (!empty($vars['output'])) { @@ -53,4 +67,4 @@ function template_preprocess_views_view_ } $vars['output'] = theme('tagadelic_weighted', $tags); } -} \ No newline at end of file +}