You are here

function render_cache_entity_view_single in Render cache 7

Same name and namespace in other branches
  1. 7.2 modules/controller/render_cache_entity/render_cache_entity.module \render_cache_entity_view_single()

Helper function to view a single entity.

This can be used to replace node_view(), comment_view(), easier.

Parameters

string $entity_type: The type of the entity.

object $entity: The entity to render.

string $view_mode: A view mode as used by this entity type, e.g. 'full', 'teaser'...

Return value

array A renderable array.

7 calls to render_cache_entity_view_single()
ds_views_row_render_render_cache_comment in modules/render_cache_ds/views/plugins/render_cache_hijack_views_plugin_ds_entity_view.inc
Render the comment through the entity plugin.
ds_views_row_render_render_cache_file_managed in modules/render_cache_ds/views/plugins/render_cache_hijack_views_plugin_ds_entity_view.inc
Render the file through the entity plugin.
ds_views_row_render_render_cache_micro in modules/render_cache_ds/views/plugins/render_cache_hijack_views_plugin_ds_entity_view.inc
Render the micro through the entity plugin.
ds_views_row_render_render_cache_node in modules/render_cache_ds/views/plugins/render_cache_hijack_views_plugin_ds_entity_view.inc
Render the node through the entity plugin.
ds_views_row_render_render_cache_taxonomy_term_data in modules/render_cache_ds/views/plugins/render_cache_hijack_views_plugin_ds_entity_view.inc
Render the taxonomy term through the entity plugin.

... See full list

File

./render_cache.module, line 384
Hook implementations and frequently used functions for render cache module.

Code

function render_cache_entity_view_single($entity_type, $entity, $view_mode) {
  list($entity_id) = entity_extract_ids($entity_type, $entity);
  $build = entity_view($entity_type, array(
    $entity_id => $entity,
  ), $view_mode);

  // The output needs to be compatible to what the single function would have
  // returned.
  if (isset($build[$entity_type][$entity_id])) {
    return $build[$entity_type][$entity_id];
  }
  return array();
}