fid;
$icon = theme('file_icon', array('file' => $file, 'icon_directory' => $icon_directory));
// Set options as per anchor format described at
// http://microformats.org/wiki/file-format-examples
$options = array(
'attributes' => array(
'type' => $file->filemime . '; length=' . $file->filesize,
),
);
// Use the description as the link text if available.
if (empty($file->description)) {
$link_text = $file->filename;
}
else {
$link_text = $file->description;
$options['attributes']['title'] = check_plain($file->filename);
}
return '' . $icon . ' ' . l($link_text, $url, $options) . '';
}
/**
* Copy of theme_file_file_link() for linking to the file download URL.
*
* @see theme_file_file_link()
*/
function theme_file_entity_download_link($variables) {
$file = $variables['file'];
$icon_directory = $variables['icon_directory'];
$uri = file_entity_download_uri($file);
$icon = theme('file_icon', array('file' => $file, 'icon_directory' => $icon_directory));
// Set options as per anchor format described at
// http://microformats.org/wiki/file-format-examples
$uri['options']['attributes']['type'] = $file->filemime . '; length=' . $file->filesize;
// Provide the default link text.
if (!isset($variables['text'])) {
$variables['text'] = t('Download [file:name]');
}
// Peform unsanitized token replacement if $uri['options']['html'] is empty
// since then l() will escape the link text.
$variables['text'] = token_replace($variables['text'], array('file' => $file), array('clear' => TRUE, 'sanitize' => empty($uri['options']['html'])));
$output = '' . $icon . ' ' . l($variables['text'], $uri['path'], $uri['options']);
$output .= ' ' . '(' . format_size($file->filesize) . ')';
$output .= '';
return $output;
}
/**
* Returns HTML for displaying an HTML5