You are here

function theme_download_file_direct_download_icon_item in DownloadFile 7

Same name and namespace in other branches
  1. 6 download_file.formatter.inc \theme_download_file_direct_download_icon_item()
  2. 7.3 download_file.formatter.inc \theme_download_file_direct_download_icon_item()
  3. 7.2 download_file.formatter.inc \theme_download_file_direct_download_icon_item()

Theme function for the 'direct_download_icon' multiple file formatter.

Parameters

$file: File to format.

Return value

A string containing the HTML ouput.

1 theme call to theme_download_file_direct_download_icon_item()
theme_download_file_formatter_direct_download_icon in ./download_file.formatter.inc
Theming function for displaying the link to direct download the file with the type icon.

File

./download_file.formatter.inc, line 132

Code

function theme_download_file_direct_download_icon_item($variables) {
  $file = $variables['file'];

  // Views may call this function with a NULL value, return an empty string.
  if (empty($file->fid)) {
    return '';
  }
  $url = download_file_path($file->fid);
  $icon = theme('file_icon', array(
    'file' => $file,
  ));
  $options = array();

  // Use the description or the title as the link text if available.
  if (empty($file->description) && empty($file->title)) {
    $link_text = $file->filename;
  }
  else {
    if (!empty($file->description)) {
      $link_text = $file->description;
    }
    else {
      if (!empty($file->title)) {
        $link_text = $file->title;
      }
    }
    $options['attributes']['title'] = $file->filename;
  }
  return '<div class="download-file clear-block">' . $icon . l($link_text, $url, $options) . '</div>';
}