You are here

function file_entity_file_display_content_type_render in File Entity (fieldable files) 7.2

Same name and namespace in other branches
  1. 7.3 plugins/content_types/file_display.inc \file_entity_file_display_content_type_render()

Render the node content.

File

plugins/content_types/file_display.inc, line 21

Code

function file_entity_file_display_content_type_render($subtype, $conf, $panel_args, $context) {
  if (!empty($context) && empty($context->data)) {
    return;
  }
  $file = isset($context->data) ? clone $context->data : NULL;
  $block = new stdClass();
  $block->module = 'file_entity';
  $block->delta = $file->fid;
  if (empty($file)) {
    $block->delta = 'placeholder';
    $block->title = t('File display');
    $block->content = t('File display goes here.');
  }
  else {
    if (!empty($conf['identifier'])) {
      $file->ctools_template_identifier = $conf['identifier'];
    }
    $block->title = $file->filename;
    $block->content = file_view_file($file, $conf['displays']);
  }
  if (!empty($conf['link']) && $file) {
    $block->title_link = entity_uri('file', $file);
  }
  return $block;
}