In one of my custom Feature modules, I defined a custom file type in code, in the .module file. Then, I tried to re-export this file type through features in order to get it under the control of features. The result was the creation of a file named cw_media.file_type.inc containing an implementation of hook_file_default_types with the following:

/**
 * Implements hook_file_default_types().
 */
function cw_media_file_default_types() {
  $export = array();

  $file_type = new stdClass();
  $file_type->disabled = FALSE; /* Edit this to true to make a default file_type disabled initially */
  $file_type->api_version = 1;
  $file_type->type = 'archive';
  $file_type->label = 'Archive';
  $file_type->description = 'An <em>Archive</em> file is compressed data.';
  $export['archive'] = $file_type;

  return $export;
}

The mimetype information that I had originally added is missing. I tried editing the file type through the UI, and adding the mimetypes back in, then re-exporting the feature again. The mimetype information was still missing.

Currently, the only way I can do this is to implement hook_file_default_types_alter ontop of this to add in the mimetype information.

Comments

ParisLiakos’s picture

schemes are missing as well?

jonraedeke’s picture

I'm having the same issue. No mimetype or stream info is exported with the file type when a feature is created.

I created the custom file type using custom code like the original post and had this issue. Then, I started over and created a custom file type through the UI using the latest dev and the patch at http://drupal.org/node/1260050#comment-7151796. The mimetype and stream info is still not exported.

I'm forced to use hook_file_default_types_alter to add that info in the .module file, which makes my feature show up as overridden.

Not sure what schemes to look for.

Work done lately on this module is amazing! Just wanted to report this.

aaron’s picture

Status: Active » Closed (duplicate)

I believe that this is either a duplicate of or should be included as part of #1858370: Exporting File Field Display (Manage File Display). Feel free to change the status if you think otherwise.

Dave Reid’s picture

Status: Closed (duplicate) » Active

No, the display configuration is separate from the mimetype configuration of the file type. I think this needs to stay open.

Devin Carlson’s picture

Status: Active » Closed (duplicate)