From c1d2d9365f6cb384258007ad77bc4915b3337a05 Mon Sep 17 00:00:00 2001
From: Maciej Zgadzaj <maciej.zgadzaj@gmail.com>
Date: Thu, 1 Aug 2013 11:29:13 -0400
Subject: [PATCH] Added hook_features_export_alter() implementation

---
 search_api_et.module |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/search_api_et.module b/search_api_et.module
index bc6c81e..de2c259 100644
--- a/search_api_et.module
+++ b/search_api_et.module
@@ -140,3 +140,26 @@ function search_api_et_entity_translation_delete($entity_type, $entity, $langcod
   $item_id = $langcode . '_' . $entity_id;
   search_api_track_item_delete('search_api_et_' . $entity_type, array($item_id));
 }
+
+/**
+ * Implements hook_features_export_alter().
+ *
+ * Adds dependency information for relevant exported indexes.
+ */
+function search_api_et_features_export_alter(&$export, $module_name) {
+  if (isset($export['features']['search_api_index'])) {
+    // Check all of the exported index definitions.
+    foreach ($export['features']['search_api_index'] as $index_name) {
+      $indexes = search_api_index_load_multiple(FALSE, array('machine_name' => $index_name));
+      $index = reset($indexes);
+      $controller = search_api_get_datasource_controller($index->item_type);
+      if ($controller instanceof SearchApiEtDatasourceController) {
+        if (!isset($export['dependencies']['search_api_et'])) {
+          $export['dependencies']['search_api_et'] = 'search_api_et';
+        }
+      }
+    }
+    // Ensure the dependencies list is still sorted alphabetically.
+    ksort($export['dependencies']);
+  }
+}
-- 
1.7.2.5

