You are here

function theme_filefield in FileField 5

Same name and namespace in other branches
  1. 5.2 filefield.module \theme_filefield()
  2. 6.2 filefield.formatter.inc \theme_filefield()
2 theme calls to theme_filefield()
filefield_field_formatter in ./filefield.module
theme_filefield_view_file in ./filefield.module

File

./filefield.module, line 486
Defines a file field type.

Code

function theme_filefield($file) {
  $file = (array) $file;
  if (is_file($file['filepath'])) {
    if ($file['fid'] == 'upload') {
      $path = file_create_filename($file['filename'], file_create_path());
    }
    else {
      $path = $file['filepath'];
    }
    $url = file_create_url($path);
    $name = $file['filename'];
    $desc = $file['description'];
    return '<a href="' . check_url($url) . '">' . check_plain($name) . '</a>';
  }
}