summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--modules/taxonomy/taxonomy.module13
1 files changed, 10 insertions, 3 deletions
diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module
index 9a8ccb6..fb55d33 100644
--- a/modules/taxonomy/taxonomy.module
+++ b/modules/taxonomy/taxonomy.module
@@ -629,9 +629,13 @@ function taxonomy_node_get_terms_by_vocabulary($node, $vid, $key = 'tid') {
/**
* Find all terms associated with the given node, ordered by vocabulary and term weight.
*/
-function taxonomy_node_get_terms($node, $key = 'tid') {
+function taxonomy_node_get_terms($node, $key = 'tid', $reset = FALSE) {
static $terms;
+ if ($reset) {
+ unset($terms[$node->vid]);
+ }
+
if (!isset($terms[$node->vid][$key])) {
$result = db_query(db_rewrite_sql('SELECT t.* FROM {term_node} r INNER JOIN {term_data} t ON r.tid = t.tid INNER JOIN {vocabulary} v ON t.vid = v.vid WHERE r.vid = %d ORDER BY v.weight, t.weight, t.name', 't', 'tid'), $node->vid);
$terms[$node->vid][$key] = array();
@@ -664,7 +668,7 @@ function taxonomy_node_validate(&$node) {
/**
* Save term associations for a given node.
*/
-function taxonomy_node_save($node, $terms) {
+function taxonomy_node_save(&$node, $terms) {
taxonomy_node_delete_revision($node);
@@ -721,6 +725,9 @@ function taxonomy_node_save($node, $terms) {
}
}
}
+
+ // Flush the term "cache" for this node
+ $node->taxonomy = taxonomy_node_get_terms($node, 'tid', TRUE);
}
/**
@@ -1240,7 +1247,7 @@ function taxonomy_render_nodes($result) {
/**
* Implementation of hook_nodeapi().
*/
-function taxonomy_nodeapi($node, $op, $arg = 0) {
+function taxonomy_nodeapi(&$node, $op, $arg = 0) {
switch ($op) {
case 'load':
$output['taxonomy'] = taxonomy_node_get_terms($node);