You are here

function download_file_field_formatter_view in DownloadFile 7.2

Same name and namespace in other branches
  1. 7.3 download_file.module \download_file_field_formatter_view()
  2. 7 download_file.module \download_file_field_formatter_view()

Implementation of hook_field_formatter_view().

File

./download_file.module, line 228
Module to direct download files or images.

Code

function download_file_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
  $element = array();
  if ($items) {
    switch ($display['type']) {
      case 'direct_download':
        $element[0] = array(
          '#theme' => 'download_file_formatter_direct_download',
          '#items' => $items,
        );
        break;
      case 'direct_download_icon':
        $element[0] = array(
          '#theme' => 'download_file_formatter_direct_download_icon',
          '#items' => $items,
        );
        break;
      case 'direct_download_accessible':
        $element[0] = array(
          '#theme' => 'download_file_formatter_direct_download_accessible',
          '#items' => $items,
        );
        break;
      case 'direct_download_accessible_icon':
        $element[0] = array(
          '#theme' => 'download_file_formatter_direct_download_accessible_icon',
          '#items' => $items,
        );
        break;
      case 'direct_download_thumbnail_image':
        $element[0] = array(
          '#theme' => 'download_file_formatter_direct_download_thumbnail_image',
          '#items' => $items,
        );
        break;
    }
  }
  return $element;
}