summaryrefslogtreecommitdiff
path: root/modules/taxonomy/taxonomy.tokens.inc
diff options
context:
space:
mode:
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);
}