You are here

function taxonomy_link in Drupal 4

Same name and namespace in other branches
  1. 5 modules/taxonomy/taxonomy.module \taxonomy_link()
  2. 6 modules/taxonomy/taxonomy.module \taxonomy_link()

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)); }

3 calls to taxonomy_link()
chameleon_node in themes/chameleon/chameleon.theme
phptemplate_node in themes/engines/phptemplate/phptemplate.engine
theme_node in includes/theme.inc
Return a themed node.

File

modules/taxonomy.module, line 26
Enables the organization of content into categories.

Code

function taxonomy_link($type, $node = NULL) {
  if ($type == 'taxonomy terms' && $node != NULL) {
    $links = array();
    if (array_key_exists('taxonomy', $node)) {
      foreach ($node->taxonomy as $term) {
        $links[] = l($term->name, taxonomy_term_path($term), array(
          'rel' => 'tag',
          'title' => strip_tags($term->description),
        ));
      }
    }
    return $links;
  }
}