function taxonomy_token_values in Token 6
Same name and namespace in other branches
- 5 token_taxonomy.inc \taxonomy_token_values()
Implements hook_token_values().
File
- ./
token_taxonomy.inc, line 50 - Implementations of token module hooks for the core taxonomy module.
Code
function taxonomy_token_values($type, $object = NULL, $options = array()) {
$values = array();
// Taxonomy term tokens.
if ($type == 'taxonomy' && !empty($object)) {
$term = $object;
$vocabulary = taxonomy_vocabulary_load($term->vid);
$values['tid'] = $term->tid;
$values['cat'] = check_plain($term->name);
$values['cat-raw'] = $term->name;
$values['cat-description'] = filter_xss($term->description);
$values['vid'] = $term->vid;
$values['vocab'] = check_plain($vocabulary->name);
$values['vocab-raw'] = $vocabulary->name;
$values['vocab-description'] = filter_xss($vocabulary->description);
$values['vocab-description-raw'] = $vocabulary->description;
}
// Vocabulary tokens.
if ($type == 'vocabulary' && !empty($object)) {
$vocabulary = $object;
$values['vocabulary-vid'] = $vocabulary->vid;
$values['vocabulary-name'] = check_plain($vocabulary->name);
$values['vocabulary-name-raw'] = $vocabulary->name;
$values['vocabulary-description'] = filter_xss($vocabulary->description);
$values['vocabulary-description-raw'] = $vocabulary->description;
}
return $values;
}