? bio_views.inc
Index: bio.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/bio/bio.module,v
retrieving revision 1.2.2.8
diff -u -p -r1.2.2.8 bio.module
--- bio.module	22 Mar 2007 18:17:53 -0000	1.2.2.8
+++ bio.module	9 May 2007 20:12:09 -0000
@@ -220,5 +220,41 @@ function bio_settings() {
     '#description' => t('Display nothing but the bio node on the user profile page.'),
     '#default_value' => variable_get('bio_profile_takeover', 0),
   );
-  return system_settings_form($form);
+  $add_a_submit = system_settings_form($form);
+  $add_a_submit['#validate']['bio_settings_validate_xxx'] = array();
+  return $add_a_submit;
 }
+
+/*
+ * A submit handler for the bio settings page so that we can invalidate the views
+ * cache in case the bio node type changed. We need the _xxx suffix to keep it
+ * from interfering with the #base in system_settings_form. Also, we do it in the
+ * validate phase because submits were interfering with the #base attribute. Yuck.
+ */
+function bio_settings_validate_xxx($form_id, $form_values) {
+  views_invalidate_cache();
+}
+
+/**
+ * implementation of hook_views_table_alter()
+ *
+ * bio uses hook_views_table_alter to clone all the existing fields and handlers
+ * and repurpose them as bio related searching. Since this doesn't need to occur on
+ * every page load, we call into the bio_views.inc file for the heavy lifting.
+ */
+function bio_views_tables_alter(&$tables) {
+  require_once drupal_get_path('module', 'bio') . '/bio_views.inc';
+  return _bio_views_tables_alter($tables);
+}
+
+/*
+ * Copy of views_handler_filter_isnew($op, $filter, $filterinfo, &$query)
+ * As written this function has some very specific needs w.r.t. tables that
+ * join against node. I couldn't make the views version generic, so I copied it
+ * here. It lives in the .inc to avoid unecessary script bloat.
+ */
+function bio_handler_filter_isnew($op, $filter, $filterinfo, &$query) {
+  require_once drupal_get_path('module', 'bio') . '/bio_views.inc';
+  return _bio_handler_filter_isnew($op, $filter, $filterinfo, $query);
+}
+
