You are here

function views_handler_field_upload_fid::add_self_tokens in Views (for Drupal 7) 6.2

Same name and namespace in other branches
  1. 6.3 modules/upload/views_handler_field_upload_fid.inc \views_handler_field_upload_fid::add_self_tokens()

Add any special tokens this field might use for itself.

This method is intended to be overridden by items that generate fields as a list. For example, the field that displays all terms on a node might have tokens for the tid and the term.

By convention, tokens should follow the format of [token-subtoken] where token is the field ID and subtoken is the field. If the field ID is terms, then the tokens might be [terms-tid] and [terms-name].

Overrides views_handler_field::add_self_tokens

File

modules/upload/views_handler_field_upload_fid.inc, line 76

Class

views_handler_field_upload_fid
Field handler to provide a list of roles.

Code

function add_self_tokens(&$tokens, $item) {
  $tokens['[' . $this->options['id'] . '-fid' . ']'] = $item['fid'];
  $tokens['[' . $this->options['id'] . '-name' . ']'] = $item['filename'];
  $tokens['[' . $this->options['id'] . '-type' . ']'] = $item['filemime'];
  $tokens['[' . $this->options['id'] . '-description' . ']'] = $item['description'];
  $tokens['[' . $this->options['id'] . '-path' . ']'] = $item['filepath'];
  $tokens['[' . $this->options['id'] . '-url' . ']'] = url($item['filepath']);
  $tokens['[' . $this->options['id'] . '-size' . ']'] = $item['filesize'];
}