You are here

function filefield_token_values in FileField 6.2

Same name and namespace in other branches
  1. 5.2 filefield.module \filefield_token_values()
  2. 6.3 filefield.token.inc \filefield_token_values()

Implementation of hook_token_values(): Provide the concrete token values for a given file item.

File

./filefield.module, line 927

Code

function filefield_token_values($type, $object = NULL) {
  if ($type == 'field') {
    $item = $object[0];
    $tokens['fid'] = $item['fid'];
    $tokens['description'] = $item['description'];
    $tokens['filename'] = $item['filename'];
    $tokens['filepath'] = $item['filepath'];
    $tokens['filemime'] = $item['filemime'];
    $tokens['filesize'] = $item['filesize'];
    $tokens['filesize_formatted'] = format_size($item['filesize']);
    $tokens['view'] = $item['view'];
    return $tokens;
  }
}