You are here

function taxonomy_token_values in Token 5

Same name and namespace in other branches
  1. 6 token_taxonomy.inc \taxonomy_token_values()

Implementation of hook_token_values().

File

./token_taxonomy.inc, line 19
Implementations of token module hooks for the core taxonomy module.

Code

function taxonomy_token_values($type, $object = NULL, $options = array()) {
  $values = array();
  switch ($type) {
    case 'taxonomy':
      $category = $object;
      $vid = $category->vid;
      $vocabulary = taxonomy_get_vocabulary($vid);
      $values['tid'] = $category->tid;
      $values['cat'] = check_plain($category->name);
      $values['cat-raw'] = $category->name;
      $values['cat-description'] = filter_xss($category->description);
      $values['vid'] = $vid;
      $values['vocab'] = check_plain($vocabulary->name);
      $values['vocab-raw'] = $vocabulary->name;
      $values['vocab-description'] = filter_xss($vocabulary->description);
      break;
  }
  return $values;
}