function nd_terms_per_vocabulary in Node displays 6.3
Same name and namespace in other branches
- 6.2 nd.module \nd_terms_per_vocabulary()
- 7 nd.module \nd_terms_per_vocabulary()
Terms per vocabulary.
1 string reference to 'nd_terms_per_vocabulary'
- nd_theme in ./
nd.module - Implementation of hook_theme().
File
- ./
nd.module, line 676 - Node displays.
Code
function nd_terms_per_vocabulary($field) {
$content = '';
if (isset($field['object']->taxonomy) && !empty($field['object']->taxonomy)) {
$terms = array();
$linked = FALSE;
$vid = end(explode('_', $field['key']));
$formatter_explode = explode('_', $field['formatter']);
$separators = array(
'space' => ' ',
'comma' => ', ',
);
$separator = $separators[end($formatter_explode)];
$list = end($formatter_explode) == 'list' ? TRUE : FALSE;
$linked = prev($formatter_explode);
foreach ($field['object']->taxonomy as $tid => $term) {
if ($term->vid == $vid) {
$terms[] = $linked == 'linked' ? l($term->name, taxonomy_term_path($term)) : check_plain($term->name);
}
}
if (!empty($terms)) {
if ($separator) {
$content = implode($separator, $terms);
}
elseif ($list) {
$content = theme('item_list', $terms);
}
}
}
return $content;
}