function theme_file_link_itu in iTweak Upload 7.3
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.
- show_icon: TRUE to show icon (like theme_file_link())
- options: (optional) options for the link.
1 theme call to theme_file_link_itu()
- theme_file_formatter_table_itu in ./
itweak_upload.module - Returns HTML for a file attachments table.
File
- ./
itweak_upload.module, line 550 - iTweakUpload - Tweak attachments display and file upload forms.
Code
function theme_file_link_itu($variables) {
$file = $variables['file'];
$icon_directory = empty($variables['icon_directory']) ? NULL : $variables['icon_directory'];
$show_icon = empty($variables['show_icon']) ? FALSE : TRUE;
$options = empty($variables['options']) ? array() : $variables['options'];
$options += array(
'attributes' => array(),
);
//? $url = empty($file->path) ? file_create_url($file->uri) : $file->path;
$url = file_create_url($file->uri);
$icon = $show_icon ? theme('file_icon_itu', array(
'file' => $file,
'icon_directory' => $icon_directory,
)) . ' ' : '';
// Set options as per anchor format described at
// http://microformats.org/wiki/file-format-examples
$options['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);
}
// [#1253692] by smokris: Add a hook for other modules to alter attachment links
$data = compact('file', 'link_text', 'url', 'options');
// 'itweak_uploads_prerender' in D6, renamed to 'itweak_upload_file_link_prerender'
drupal_alter('itweak_upload_file_link_prerender', $data);
extract($data);
return '<span class="file">' . $icon . l($link_text, $url, $options) . '</span>';
}