From f0f5f1a993e2437ceed121e0e8da6e90295349e2 Mon Sep 17 00:00:00 2001 From: davereid Date: Mon, 13 Jul 2015 14:08:06 -0400 Subject: [PATCH] Issue #2515080 by Dave Reid, jenlampton: Fixed embedding files if file_entity does not yet include the fix from #2365821. --- entity_embed.module | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/entity_embed.module b/entity_embed.module index 0664624..8d38357 100644 --- a/entity_embed.module +++ b/entity_embed.module @@ -588,6 +588,12 @@ function entity_embed_render_embed($entity, $context) { // rendering. $renderable_array = entity_view($context['data-entity-type'], array($entity), $context['data-entity-embed-settings']['view_mode'], $context['data-langcode']); + // Workaround for file_entity module that does not have the patch in + // https://www.drupal.org/node/2365821 applied yet. + if ($context['data-entity-type'] === 'file' && isset($renderable_array['files'])) { + $renderable_array = array('file' => reset($renderable_array)); + } + // The output of entity_view() is keyed by the entity type and ID. $build = $renderable_array[$context['data-entity-type']][$context['data-entity-id']]; -- GitLab