public static function EntityHelper::viewMultiple in Helper 7
1 call to EntityHelper::viewMultiple()
File
- lib/
EntityHelper.php, line 445
Class
Code
public static function viewMultiple($entity_type, array $entities, $view_mode = 'default', $langcode = NULL, $page = NULL) {
if (empty($entities)) {
return array();
}
$output = entity_view($entity_type, $entities, $view_mode, $langcode, $page);
// Workaround for file_entity module that does not have the patch in
// https://www.drupal.org/node/2365821 applied yet.
if ($entity_type === 'file' && isset($output['files'])) {
$output = array(
'file' => reset($output),
);
}
return !empty($output[$entity_type]) ? $output[$entity_type] : array();
}