Index: category.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/category/category.module,v
retrieving revision 1.162
diff -u -p -r1.162 category.module
--- category.module	5 Aug 2009 04:52:53 -0000	1.162
+++ category.module	11 Oct 2009 12:42:29 -0000
@@ -1971,3 +1971,12 @@ function _category_filter_pick_elements(
 function theme_category_category_select($element) {
   return theme('select', $element);
 }
+
+/**
+ * Implementation of hook_views_api.
+ */
+function category_views_api() {
+  return array(
+    'api' => 2
+  );
+}
Index: category.views.inc
===================================================================
RCS file: category.views.inc
diff -N category.views.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ category.views.inc	11 Oct 2009 12:42:29 -0000
@@ -0,0 +1,76 @@
+<?php
+
+
+function category_views_data() {
+  $data = array();
+  $data['category_hierarchy']['table']['group'] = t('Category');
+  $data['category_hierarchy']['table']['join'] = array(
+    'node' => array(
+      'left_field' => 'nid',
+      'field' => 'cid',
+    ),
+  );
+  $data['category_hierarchy']['parent'] = array(
+    'title' => 'Parent category',
+    'help' => 'The ID of the parent category.',
+    'filter' => array(
+      'handler' => 'views_handler_filter_numeric',
+    ),
+    'relationship' => array(
+      'base' => 'node',
+      'field' => 'parent',
+      'label' => t('Parent'),
+    ),
+  );
+  $data['category_hierarchy']['cid'] = array(
+    'title' => 'Category ID',
+    'relationship' => array(
+      'base' => 'category_hierarchy',
+      'base field' => 'parent',
+      'label' => t('Child'),
+    ),
+  );
+  $data['category_hierarchy']['cid_2'] = array(
+    'title' => 'Category ID 2',
+    'relationship' => array(
+      'base' => 'node',
+      'label' => t('Node representing this cateogry.'),
+      'relationship field' => 'cid',
+    ),
+  );
+  
+  $data['category_node']['table']['group'] = t('Category');
+  $data['category_node']['table']['join'] = array(
+    'node' => array(
+      'left_field' => 'vid',
+      'field' => 'vid',
+    ),
+  );
+  $data['category_node']['cid'] = array(
+    'title' => t('ID'),
+    'help' => 'The category ID.',
+    'argument' => array(
+      'handler' => 'views_handler_argument_numeric',
+    ),
+  );
+  
+  $data['category_data']['table']['group'] = t('Category');
+  $data['category_data']['table']['join'] = array(
+    'node' => array(
+      'left_table' => 'category_node',
+      'left_field' => 'cid',
+      'table' => 'node',
+      'field' => 'nid',
+    ),
+  );
+  $data['category_data']['name'] = array(
+    'title' => t('Category'),
+    'help' => 'Categories this node belongs to.',
+    'real field' => 'title',
+    'field' => array(
+      'handler' => 'views_handler_field',
+    ),
+  );  
+  
+  return $data;
+}
