--- modules/filter.views.inc.0	2009-03-21 20:06:04.000000000 +0000
+++ modules/filter.views.inc	2009-04-11 17:49:39.000000000 +0100
@@ -0,0 +1,55 @@
+<?php
+// $Id$
+/**
+ * @file
+ * Provide basic views data for filter.module.
+ */
+
+/**
+ * @defgroup views_filter_module filter.module handlers
+ *
+ * Only includes the table 'filter_formats'. 
+ * @{
+ */
+
+/**
+ * Implementation of hook_views_data()
+ */
+function filter_views_data() {
+  // ----------------------------------------------------------------------
+  // filter_formats table
+  
+  // Have not defined $data['filter_formats']['table']['group'] since
+  // no fields are defined here yet.
+  $data['filter_formats']['table']['join'] = array(
+    'node_revisions' => array(
+      'left_field' => 'format',
+      'field' => 'format',
+    ),
+    'node' => array(
+      'left_table' => 'node_revisions',
+      'left_field' => 'format',
+      'field' => 'format',
+    ),
+  );
+
+  return $data;
+}
+
+function filter_views_handlers() {
+  return array(
+    'info' => array(
+      'path' => drupal_get_path('module', 'views') . '/modules/filter',
+    ),
+    'handlers' => array(
+      // field handlers
+      'views_handler_field_filter_format_name' => array(
+        'parent' => 'views_handler_field',
+      ),
+    ),
+  );
+}
+
+/**
+ * @}
+ */
--- includes/handlers.inc.1.105	2009-04-03 18:14:54.000000000 +0100
+++ includes/handlers.inc	2009-04-11 17:37:05.000000000 +0100
@@ -1322,6 +1322,8 @@ function book_views_api() { return views
 
 function comment_views_api() { return views_views_api(); }
 
+function filter_views_api() { return views_views_api(); }
+
 function node_views_api() { return views_views_api(); }
 
 function poll_views_api() { return views_views_api(); }
--- modules/node.views.inc.1.91	2009-04-03 18:14:55.000000000 +0100
+++ modules/node.views.inc	2009-04-11 17:56:36.000000000 +0100
@@ -463,6 +463,39 @@ function node_views_data() {
     ),
   );
 
+  // input format id
+  $data['node_revisions']['format'] = array(
+    'title' => t('Input format id'), // The item it appears as on the UI,
+    'help' => t('The numeric input format of the node revision. !default means the default input format.', array('!default' => FILTER_FORMAT_DEFAULT)), // The help that appears on the UI,
+     // Information for displaying an input format as a field
+    'field' => array(
+      'handler' => 'views_handler_field_numeric',
+      'click sortable' => TRUE,
+    ),
+    // Information for sorting on input format
+    'sort' => array(
+      'handler' => 'views_handler_sort',
+    ),
+    // Information for accepting input format as a filter
+    'filter' => array(
+      'handler' => 'views_handler_filter_numeric',
+    ),
+  );
+
+  // input format name
+  // A (numeric) format of 0 means the default; Drupal also applies the default
+  // if the format specifed for a node revision has been deleted.
+  // This complexity makes sorting and filtering by format name tricky,
+  // hence these are not yet supported.
+  $data['node_revisions']['format_name'] = array(
+    'title' => t('Input format'), // The item it appears as on the UI,
+    'help' => t('The name of the input format of the node revision.'), // The help that appears on the UI,
+     // Information for displaying an input format as a field
+    'field' => array(
+      'handler' => 'views_handler_field_filter_format_name',
+    ),
+  );
+
   $data['node_revisions']['revert_revision'] = array(
     'field' => array(
       'title' => t('Revert link'),
--- modules/filter/views_handler_field_filter_format_name.inc.0	2009-03-23 19:19:05.000000000 +0000
+++ modules/filter/views_handler_field_filter_format_name.inc	2009-04-11 17:49:57.000000000 +0100
@@ -0,0 +1,29 @@
+<?php
+// $Id$
+/**
+ * Field handler to output the name of an input format.
+ */
+class views_handler_field_filter_format_name extends views_handler_field {
+  function construct() {
+    parent::construct();
+    // Be explicit about the table we are using.
+    $this->additional_fields['name'] = array('table' => 'filter_formats', 'field' => 'name');
+  }
+
+  function query() {
+    $this->ensure_my_table();
+    $this->add_additional_fields();
+  }
+
+  function render($values) {
+    $format_name = $values->{$this->aliases['name']};
+    if (!$format_name) {
+      // Default or invalid input format.
+      // filter_formats() will reliably return the default format even if the
+      // current user is unprivileged.
+      $format = filter_formats(variable_get('filter_default_format', 1));
+      return $format->name;
+    }
+    return $format_name;
+  }
+}
