taxonomy_link
Definition
taxonomy_link($type, $node = NULL)
modules/taxonomy.module, line 26
Description
Implementation of hook_link().
This hook is extended with $type = 'taxonomy terms' to allow themes to print lists of terms associated with a node. Themes can print taxonomy links with:
if (module_exist('taxonomy')) { $this->links(taxonomy_link('taxonomy terms', $node)); }
Code
<?php
function taxonomy_link($type, $node = NULL) {
if ($type == 'taxonomy terms' && $node != NULL) {
$links = array();
if (array_key_exists('taxonomy', $node)) {
foreach ($node->taxonomy as $tid) {
$term = taxonomy_get_term($tid);
$links[] = l($term->name, 'taxonomy/term/'. $term->tid);
}
}
else {
$links = array();
foreach (taxonomy_node_get_terms($node->nid) as $term) {
$links[] = l($term->name, 'taxonomy/term/'. $term->tid);
}
}
return $links;
}
}
?> 