Posted by cels on December 30, 2009 at 1:32pm
5 followers
Jump to:
| Project: | Primary Term |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | sethcohn |
| Status: | closed (fixed) |
Issue Summary
A simple feature, quick&dirty: add a token for the primary term vocab:
<?php
function primary_term_token_list($type = 'all') {
//...
$tokens['node']['primary-termpath-raw'] = t('Full Path to Primary Term');
+ $tokens['node']['primary-term-vocab'] = t('Name of the vocab of primary term');
return $tokens;
}
}
function primary_term_token_values($type, $object = NULL) {
//....
//....
//....
$values['primary-termpath-raw'] = drupal_get_path_alias(taxonomy_term_path($term));
+ $vocab = db_fetch_object(db_query('SELECT name FROM {vocabulary} WHERE vid = %d', $term->vid));
+ $values['primary-term-vocab'] = $vocab->name;
}
break;
}
return $values;
}
?>I use to with the ericduran's zip patchs: http://drupal.org/node/588166
Comments
#1
Seems worthwhile
#2
Rather than making the database call, should call taxonomy_vocabulary_load instead. Otherwise, +1.
#3
Committed this token along with the ones from #502138: Token support should include full path like [termpath] token:
http://drupal.org/cvs?commit=435614
#4
Automatically closed -- issue fixed for 2 weeks with no activity.