From 931132fcef4f4d5e9b462bc7b7deb1d204e6bcc9 Mon Sep 17 00:00:00 2001
From: Mike Potter <mpotter@phase2technology.com>
Date: Tue, 20 Mar 2012 15:23:56 -0400
Subject: [PATCH] Revert "Issue #1432264 by ezra-g, tim.plunkett | samhassell: Fixed Changes to hook_views_api() cause Views plugins to be undefined."

This reverts commit ef2f805876ff37b3e3523dad845962ebc643a16e.
---
 includes/features.ctools.inc |   27 ++++++++++++++++++++++-----
 1 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/includes/features.ctools.inc b/includes/features.ctools.inc
index 5a82f81..85764d9 100644
--- a/includes/features.ctools.inc
+++ b/includes/features.ctools.inc
@@ -67,19 +67,36 @@ function ctools_features_export($data, &$export, $module_name = '') {
 
 /**
  * Implements hook_features_export_render().
- *
  * Adds the ctools mothership hook, ctools_plugin_api().
  */
 function ctools_features_export_render($module, $data) {
-  $component_exports = array();
-  ctools_include('plugins');
+  $code = array();
+  $code[] = '  list($module, $api) = func_get_args();';
+
+  $component_exports =  array();
   foreach ($data as $component) {
+    $code = array();
+    $code[] = '  list($module, $api) = func_get_args();';
+
     if ($info = _ctools_features_get_info($component)) {
-      $plugin_api_hook_name = ctools_plugin_api_get_hook($info['module'], $info['api']);
-      $component_exports[$plugin_api_hook_name] = '  return array("version" => "'. $info['current_version'] .'");';
+
+      $code[] = '  if ($module == "'. $info['module'] .'" && $api == "'. $info['api'] .'") {';
+      $code[] = '    return array("version" => "'. $info['current_version'] .'");';
+      $code[] = '  }';
+    }
+    ctools_include('plugins');
+    $plugin_api_hook_name = ctools_plugin_api_get_hook($info['module'], $info['api']);
+
+    if (key_exists($plugin_api_hook_name, $component_exports)) {
+        $component_exports[$plugin_api_hook_name] .= "\n" . implode("\n", $code);
+    }
+    else {
+        $component_exports[$plugin_api_hook_name] = implode("\n", $code);
     }
   }
+
   return $component_exports;
+
 }
 
 /**
-- 
1.7.3.2+GitX