You are here

function entity_entity_view_content_type_render in Entity API 7

Implements hook_PLUGIN_content_type_render().

Ctools requires us to return a block.

See also

ctools_content_render()

File

ctools/content_types/entity_view.inc, line 107

Code

function entity_entity_view_content_type_render($entity_type, $conf, $panel_args, $context) {
  if ($context->empty) {
    return;
  }
  $block = new stdClass();
  $block->module = 'entity';
  $block->delta = $entity_type . '-' . str_replace('-', '_', $conf['view_mode']);
  $entity_id = $context->argument;
  $entity = entity_load_single($entity_type, $entity_id);
  $block->content = entity_view($entity_type, array(
    $entity_id => $entity,
  ), $conf['view_mode']);
  return $block;
}