You are here

function file_entity_file_content_content_type_render in File Entity (fieldable files) 7.2

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

Render the node content.

File

plugins/content_types/file_content.inc, line 22

Code

function file_entity_file_content_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 title.');
    $block->content = t('File content goes here.');
  }
  else {
    if (!empty($conf['identifier'])) {
      $node->ctools_template_identifier = $conf['identifier'];
    }
    $block->title = $file->filename;
    $block->content = file_build_content($file, $conf['view_mode']);
  }
  if (!empty($conf['link']) && $file) {
    $block->title_link = entity_uri('file', $file);
  }
  return $block;
}