diff options
Diffstat (limited to 'modules/taxonomy')
-rw-r--r-- | modules/taxonomy/taxonomy.module | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index 10c1f3317..256e0364b 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -36,6 +36,15 @@ function taxonomy_link($type, $node = NULL) { menu("admin/taxonomy/help", "help", "taxonomy_admin", NULL, 9); } else if ($type == "taxonomy terms" && $node != NULL) { + + if ($node->taxonomy) { + foreach ($node->taxonomy as $tid) { + $term = taxonomy_get_term($tid); + $links[] = l($term->name, "taxonomy/page/or/$term->tid", $term->description ? array("title" => $term->description) : array()); + } + } + else { + /* ** Themes can print taxonomy links with: ** @@ -44,12 +53,12 @@ function taxonomy_link($type, $node = NULL) { ** } */ - $links = array(); + $links = array(); + foreach (taxonomy_node_get_terms($node->nid) as $term) { + $links[] = l($term->name, "taxonomy/page/or/$term->tid", $term->description ? array("title" => $term->description) : array()); + } - foreach (taxonomy_node_get_terms($node->nid) as $term) { - $links[] = l($term->name, "taxonomy/page/or/$term->tid", $term->description ? array("title" => $term->description) : array()); } - return $links; } } @@ -676,6 +685,21 @@ function taxonomy_render_nodes($result) { print pager_display_default(NULL, variable_get("default_nodes_main", 10), 0); } +function taxonomy_nodeapi($node, $op, $arg = 0) { + + switch ($op) { + case "insert": + taxonomy_node_save($node->nid, $node->taxonomy); + break; + case "update": + taxonomy_node_save($node->nid, $node->taxonomy); + break; + case "delete": + taxonomy_node_delete($node->nid); + break; + } +} + function taxonomy_page() { |