From aef264dfb64de218a84f5ecff32d6423a53f02eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Hojtsy?= Date: Thu, 22 Nov 2007 13:18:01 +0000 Subject: #192887 by webernet: fix notice displayed on node form, when node has no taxonomy property --- modules/taxonomy/taxonomy.module | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) (limited to 'modules/taxonomy/taxonomy.module') 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; -- cgit v1.2.3