diff options
author | Dries Buytaert <dries@buytaert.net> | 2003-04-15 19:50:04 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2003-04-15 19:50:04 +0000 |
commit | 2de4c1c643d3c23e814bc9f765ffa3e0eabdd696 (patch) | |
tree | 852ae736da509bf40636f9ba2a0e574d5c51286b /modules/taxonomy/taxonomy.module | |
parent | 86ddee8dc586e57456c9bc8fc97fe1c15b4b1c4e (diff) | |
download | brdo-2de4c1c643d3c23e814bc9f765ffa3e0eabdd696.tar.gz brdo-2de4c1c643d3c23e814bc9f765ffa3e0eabdd696.tar.bz2 |
- 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"
Diffstat (limited to 'modules/taxonomy/taxonomy.module')
-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() { |