diff -rupN primary_term/plugins/relationships/primary_term_from_node.inc primary_term_new/plugins/relationships/primary_term_from_node.inc
--- primary_term/plugins/relationships/primary_term_from_node.inc	1970-01-01 01:00:00.000000000 +0100
+++ primary_term_new/plugins/relationships/primary_term_from_node.inc	2010-05-10 15:37:11.000000000 +0200
@@ -0,0 +1,36 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Plugin to provide an relationship handler for the primary term from node.
+ * Based on CTools' term_from_node relationship
+ */
+
+/**
+ * Plugins are described by creating a $plugin array which will be used
+ * by the system that includes this file.
+ */
+$plugin = array(
+  'title' => t('Primary term from node'),
+  'keyword' => 'primary_term',
+  'description' => t('Adds the primary term from a node context'),
+  'required context' => new ctools_context_required(t('Node'), 'node'),
+  'context' => 'primary_term_from_node_context',
+  'defaults' => array('vid' => ''),
+);
+
+/**
+ * Return a new context based on an existing context.
+ */
+function primary_term_from_node_context($context, $conf) {
+  // If unset it wants a generic, unfilled context, which is just NULL.
+  if (empty($context->data)) {
+    return ctools_context_create_empty('term', NULL);
+  }
+
+  if (isset($context->data->primary_term)) {
+    return ctools_context_create('term', $context->data->primary_term);
+  }
+}
+
diff -rupN primary_term/primary_term.module primary_term_new/primary_term.module
--- primary_term/primary_term.module	2008-09-15 16:14:57.000000000 +0200
+++ primary_term_new/primary_term.module	2010-05-10 15:29:48.000000000 +0200
@@ -208,3 +208,20 @@ function primary_term_views_data() {
   );
   return $tables;
 }
+
+/**********************************************************************
+ * CTools support
+ **********************************************************************/
+
+/**
+ * Implementation of hook_ctools_plugin_directory().
+ *
+ * It simply tells panels where to find the .inc files that define various
+ * args, contexts, content_types. In this case the subdirectories of
+ * mypane/panels are used.
+ */
+function primary_term_ctools_plugin_directory($module, $plugin) {
+  if ($module == 'ctools' && !empty($plugin)) {
+    return "plugins/$plugin";
+  }
+}
\ No newline at end of file
