function theme_file_link

×

Error message

User warning: The following module is missing from the file system: theme/theme. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1156 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
cis7 file.module theme_file_link($variables)
cle7 file.module theme_file_link($variables)
elmsmedia7 file.module theme_file_link($variables)
icor7 file.module theme_file_link($variables)
meedjum_blog7 file.module theme_file_link($variables)
mooc7 file.module theme_file_link($variables)

Returns HTML for a link to a file.

Parameters

$variables: An associative array containing:

  • file: A file object to which the link will be created.
  • icon_directory: (optional) A path to a directory of icons to be used for files. Defaults to the value of the "file_icon_directory" variable.

Related topics

2 theme calls to theme_file_link()
file_managed_file_process in modules/file/file.module
Process function to expand the managed_file element type.
theme_file_formatter_table in modules/file/file.field.inc
Returns HTML for a file attachments table.
6 string references to the theme hook from theme_file_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_build_content in sites/all/modules/ulmus/file_entity/file_entity.file_api.inc
Builds a structured array representing the file's content.
file_field_formatter_view in modules/file/file.field.inc
Implements hook_field_formatter_view().
file_managed_file_process in modules/file/file.module
Process function to expand the managed_file element type.
file_theme in modules/file/file.module
Implements hook_theme().
file_view_file in sites/all/modules/ulmus/file_entity/file_entity.file_api.inc
Generate an array for rendering just the file portion of a file entity.

... See full list

File

modules/file/file.module, line 722
Defines a "managed_file" Form API field and a "file" field for Field module.

Code

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

  $url = file_create_url($file->uri);
  $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 '<span class="file">' . $icon . ' ' . l($link_text, $url, $options) . '</span>';
}
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.