You are here

function asset_field_formatter in Asset 5.2

Same name and namespace in other branches
  1. 5 modules/asset_content.inc \asset_field_formatter()
  2. 6 modules/asset_content.inc \asset_field_formatter()

Implementation of hook_field_formatter().

File

modules/asset_content.inc, line 150

Code

function asset_field_formatter($field, $item, $formatter, $node) {
  $asset = asset_load($item['aid']);
  if ($asset->aid) {
    switch ($formatter) {
      case 'default':
        return asset_view($asset);
      case 'icon':
        return asset_icon($asset);
      default:
        return asset_render($asset, array(
          'format' => $formatter,
        ));
    }
  }
}