rendered paste bodyindex 10d1cf2..c1974ab 100644
--- a/file_entity/file_entity.module
+++ b/file_entity/file_entity.module
@@ -115,6 +115,7 @@ function file_entity_theme() {
* fields can be configured per file type.
*/
function file_entity_entity_info_alter(&$entity_info) {
+ $entity_info['file']['controller class'] = FileEntityControllerClass;
$entity_info['file']['fieldable'] = TRUE;
$entity_info['file']['entity keys']['bundle'] = 'type';
$entity_info['file']['bundles'] = array();
@@ -132,6 +133,17 @@ function file_entity_entity_info_alter(&$entity_info) {
}
}
+class FileEntityControllerClass extends DrupalDefaultEntityController {
+ function attachLoad($queried_entities, $revision_id) {
+ foreach ($queried_entities as $file) {
+ if (!$file->type) {
+ $file->type = file_get_type($file);
+ }
+ }
+ parent::attachLoad($queried_entities, $revision_id);
+ }
+}
+
/**
* Implements hook_field_extra_fields().
*