summaryrefslogtreecommitdiff
path: root/modules/taxonomy/taxonomy.tokens.inc
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2010-08-03 02:17:18 +0000
committerDries Buytaert <dries@buytaert.net>2010-08-03 02:17:18 +0000
commitf645ab468a57a9c8d5d5cac70c29dd0315f149d4 (patch)
tree5a902aaadd36a7c531db45ada7a15ccb3a482004 /modules/taxonomy/taxonomy.tokens.inc
parent98ef4e3e4ad8cc330af27a267ee0ab2406c1939f (diff)
downloadbrdo-f645ab468a57a9c8d5d5cac70c29dd0315f149d4.tar.gz
brdo-f645ab468a57a9c8d5d5cac70c29dd0315f149d4.tar.bz2
- Patch #844410 by Dave Reid: taxonomy parents need to be saved before term hooks are called.
Diffstat (limited to 'modules/taxonomy/taxonomy.tokens.inc')
-rw-r--r--modules/taxonomy/taxonomy.tokens.inc10
1 files changed, 5 insertions, 5 deletions
diff --git a/modules/taxonomy/taxonomy.tokens.inc b/modules/taxonomy/taxonomy.tokens.inc
index 97a62901b..21baca7e0 100644
--- a/modules/taxonomy/taxonomy.tokens.inc
+++ b/modules/taxonomy/taxonomy.tokens.inc
@@ -128,9 +128,10 @@ function taxonomy_tokens($type, $tokens, array $data = array(), array $options =
break;
case 'parent':
- $parents = taxonomy_get_parents($term->tid);
- $parent = array_pop($parents);
- $replacements[$original] = check_plain($parent->name);
+ if ($parents = taxonomy_get_parents($term->tid)) {
+ $parent = array_pop($parents);
+ $replacements[$original] = check_plain($parent->name);
+ }
break;
}
}
@@ -140,8 +141,7 @@ function taxonomy_tokens($type, $tokens, array $data = array(), array $options =
$replacements += token_generate('vocabulary', $vocabulary_tokens, array('vocabulary' => $vocabulary), $options);
}
- if ($vocabulary_tokens = token_find_with_prefix($tokens, 'parent')) {
- $parents = taxonomy_get_parents($term->tid);
+ if (($vocabulary_tokens = token_find_with_prefix($tokens, 'parent')) && $parents = taxonomy_get_parents($term->tid)) {
$parent = array_pop($parents);
$replacements += token_generate('term', $vocabulary_tokens, array('term' => $parent), $options);
}