From 2de4c1c643d3c23e814bc9f765ffa3e0eabdd696 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Tue, 15 Apr 2003 19:50:04 +0000 Subject: - Node API improvements by Moshe: "implemented pieces of kjartan's original nodeAPI patch. the mingling of other modules into node.module logic decreases (a good thing). for example, the string "taxonomy" now appears nowhere in node.module - moved the saving of taxonomy terms when submitting a node out of node.module and into taxonomy.module - moved the deletion of comments while deleting a node out of node.module and into comment.module - improved usability of node forms by including node type in the title of the box and page" --- modules/taxonomy/taxonomy.module | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) (limited to 'modules/taxonomy') 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() { -- cgit v1.2.3