? features-hook_features_export_assets.patch
Index: features.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/features/features.admin.inc,v
retrieving revision 1.1.2.68
diff -u -p -r1.1.2.68 features.admin.inc
--- features.admin.inc	20 Aug 2010 14:51:38 -0000	1.1.2.68
+++ features.admin.inc	17 Feb 2011 08:08:20 -0000
@@ -254,6 +254,16 @@ function features_export_build_form_subm
         }
       }
     }
+    if ($assets = features_export_assets($export, $module_name)) {
+      foreach ($assets as $component => $component_files) {
+        foreach ($component_files as $asset) {
+          $contents = file_get_contents($asset);
+          $asset = pathinfo($asset);
+          print features_tar_create("{$module_name}/assets/{$component}/{$asset['basename']}", $contents);
+          unset($contents);
+        }
+      }
+    }
     print pack("a1024","");
     exit;
   }
Index: features.api.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/features/Attic/features.api.php,v
retrieving revision 1.1.2.4
diff -u -p -r1.1.2.4 features.api.php
--- features.api.php	27 Sep 2010 15:44:38 -0000	1.1.2.4
+++ features.api.php	17 Feb 2011 08:08:20 -0000
@@ -164,6 +164,32 @@ function hook_features_export_render($mo
  * component, not the module, eg. [component]_features_export() rather than
  * [module]_features_export().
  *
+ * Define assets to be exported.
+ *
+ * @param string $module_name
+ *   The name of the feature module to be exported.
+ * @param array $data
+ *   An array of machine name identifiers for the objects to be rendered.
+ * @param array $export
+ *   The full export array of the current feature being exported. This is only
+ *   passed when hook_features_export_assets() is invoked for an actual feature
+ *   update or recreate, not during state checks or other operations.
+ * @return array
+ *   An associative array of files to be exported.
+ */
+function hook_features_export_assets($module_name, $data, $export = NULL) {
+  $files = array();
+  foreach ($data as $name) {
+    $files[] = mycomponent_file($name);
+  }
+  return $files;
+}
+
+/**
+ * Component hook. The hook should be implemented using the name ot the
+ * component, not the module, eg. [component]_features_export() rather than
+ * [module]_features_export().
+ *
  * Revert all component objects for a given feature module.
  *
  * @param string $module_name
Index: features.export.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/features/features.export.inc,v
retrieving revision 1.1.2.63
diff -u -p -r1.1.2.63 features.export.inc
--- features.export.inc	27 Sep 2010 15:43:56 -0000	1.1.2.63
+++ features.export.inc	17 Feb 2011 08:08:21 -0000
@@ -255,6 +255,36 @@ function features_export_render($export,
 }
 
 /**
+ * Build an array of all required asset files.
+ *
+ * @param $export
+ *  An exported feature definition.
+ * @param $module_name
+ *  The name of the module to be exported.
+ *
+ * @return array of asset files to be exported.
+ */
+function features_export_assets($export, $module_name) {
+  features_include();
+  $files = array();
+
+  // Sort components to keep exported code consistent
+  ksort($export['features']);
+
+  foreach ($export['features'] as $component => $data) {
+    if (!empty($data)) {
+      // Sort the items so that we don't generate different exports based on order
+      asort($data);
+      if (features_hook($component, 'features_export_assets')) {
+        $assets = features_invoke($component, 'features_export_assets', $module_name, $data, $export);
+        $files[$component] = $assets;
+      }
+    }
+  }
+  return $files;
+}
+
+/**
  * Detect differences between DB and code components of a feature.
  */
 function features_detect_overrides($module) {
