Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save bangpound/812347ee8f18bc1871d6 to your computer and use it in GitHub Desktop.
Save bangpound/812347ee8f18bc1871d6 to your computer and use it in GitHub Desktop.
diff --git a/file_entity.file_api.inc b/file_entity.file_api.inc
index 85309eb..15fa5fe 100644
--- a/file_entity.file_api.inc
+++ b/file_entity.file_api.inc
@@ -160,6 +160,14 @@ function file_build_content($file, $view_mode = 'full', $langcode = NULL) {
// Remove previously built content, if exists.
$file->content = array();
+ // Allow modules to change the view mode.
+ $context = array(
+ 'entity_type' => 'file',
+ 'entity' => $file,
+ 'langcode' => $langcode,
+ );
+ drupal_alter('entity_view_mode', $view_mode, $context);
+
// Build the actual file display.
// @todo Figure out how to clean this crap up.
$file->content['file'] = file_view_file($file, $view_mode, $langcode);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment