From 92acb92699bf2127569125689fc522f6edaf7c1c Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Tue, 10 Jan 2006 12:35:20 +0000 Subject: - Patch #33747 by Ber and Moshe: bugfix + code improvement: clean up some of the taxonomy loading code. --- modules/taxonomy/taxonomy.module | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'modules/taxonomy/taxonomy.module') diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index f56fa8338..de8b86404 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -28,13 +28,7 @@ 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_path($term), array('rel' => 'tag', 'title' => $term->description)); - } - } - else { - foreach (taxonomy_node_get_terms($node->nid) as $term) { + foreach ($node->taxonomy as $term) { $links[] = l($term->name, taxonomy_term_path($term), array('rel' => 'tag', 'title' => $term->description)); } } @@ -1009,6 +1003,9 @@ function taxonomy_render_nodes($result) { */ function taxonomy_nodeapi($node, $op, $arg = 0) { switch ($op) { + case 'load': + $output['taxonomy'] = taxonomy_node_get_terms($node->nid); + return $output; case 'insert': taxonomy_node_save($node->nid, $node->taxonomy); break; @@ -1184,8 +1181,7 @@ function taxonomy_admin() { */ function taxonomy_rss_item($node) { $output = array(); - $terms = taxonomy_node_get_terms($node->nid); - foreach ($terms as $term) { + foreach ($node->taxonomy as $term) { $output[] = array('key' => 'category', 'value' => check_plain($term->name), 'attributes' => array('domain' => url('taxonomy/term/'. $term->tid, NULL, NULL, TRUE))); -- cgit v1.2.3