function theme_file_entity_download_link

cis7 file_entity.theme.inc theme_file_entity_download_link($variables)
cle7 file_entity.theme.inc theme_file_entity_download_link($variables)
elmsmedia7 file_entity.theme.inc theme_file_entity_download_link($variables)
icor7 file_entity.theme.inc theme_file_entity_download_link($variables)
meedjum_blog7 file_entity.theme.inc theme_file_entity_download_link($variables)
mooc7 file_entity.theme.inc theme_file_entity_download_link($variables)

Copy of theme_file_file_link() for linking to the file download URL.

See also

theme_file_file_link()

2 string references to the theme hook from theme_file_entity_download_link()

Note: this list is generated by looking for the string for this theme hook, so it may include some references that are not actually using this theme hook.

file_entity_field_formatter_view in sites/all/modules/ulmus/file_entity/file_entity.field.inc
Implements hook_field_formatter_view().
file_entity_theme in sites/all/modules/ulmus/file_entity/file_entity.module
Implements hook_theme().

File

sites/all/modules/ulmus/file_entity/file_entity.theme.inc, line 45
Theme callbacks for the file entity module.

Code

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 = '<span class="file">' . $icon . ' ' . l($variables['text'], $uri['path'], $uri['options']);
  $output .= ' ' . '<span class="file-size">(' . format_size($file->filesize) . ')</span>';
  $output .= '</span>';

  return $output;
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.