summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/taxonomy/taxonomy.module34
1 files changed, 18 insertions, 16 deletions
diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module
index a3ec72cbe..1b8e7e10d 100644
--- a/modules/taxonomy/taxonomy.module
+++ b/modules/taxonomy/taxonomy.module
@@ -513,24 +513,26 @@ function taxonomy_form_alter(&$form, $form_state, $form_id) {
*/
function taxonomy_preview_terms($node) {
$taxonomy = array();
- foreach ($node->taxonomy as $key => $term) {
- unset($node->taxonomy[$key]);
- // A 'Multiple select' and a 'Free tagging' field returns an array.
- if (is_array($term)) {
- foreach ($term as $tid) {
- if ($key == 'tags') {
- // Free tagging; the values will be saved for later as strings
- // instead of objects to fill the form again.
- $taxonomy['tags'] = $term;
- }
- else {
- $taxonomy[$tid] = taxonomy_get_term($tid);
+ if (isset($node->taxonomy)) {
+ foreach ($node->taxonomy as $key => $term) {
+ unset($node->taxonomy[$key]);
+ // A 'Multiple select' and a 'Free tagging' field returns an array.
+ if (is_array($term)) {
+ foreach ($term as $tid) {
+ if ($key == 'tags') {
+ // Free tagging; the values will be saved for later as strings
+ // instead of objects to fill the form again.
+ $taxonomy['tags'] = $term;
+ }
+ else {
+ $taxonomy[$tid] = taxonomy_get_term($tid);
+ }
}
}
- }
- // A 'Single select' field returns the term id.
- elseif ($term) {
- $taxonomy[$term] = taxonomy_get_term($term);
+ // A 'Single select' field returns the term id.
+ elseif ($term) {
+ $taxonomy[$term] = taxonomy_get_term($term);
+ }
}
}
return $taxonomy;